JMeter 的 JVM 在 10 分钟后崩溃

JMeter's JVM crashes after 10 minutes

我在 10 个从站上使用 JMeter。执行 10 分钟后 java 崩溃:


# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000051c39ea0, pid=2488, tid=0x0000000000000ac0
#
# JRE version: Java(TM) SE Runtime Environment (8.0_181-b13) (build 1.8.0_181-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.181-b13 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# V  [jvm.dll+0x69ea0]
#
# Core dump written. Default location: C:\apache-jmeter-3.1\bin\hs_err_pid2488.mdmp
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#  

VM Arguments:
jvm_args: -XX:+HeapDumpOnOutOfMemoryError -Xms512m -Xmx3276m -XX:NewSize=128m -XX:MaxNewSize=128m -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50 -XX:MaxTenuringThreshold=2 -XX:+CMSClassUnloadingEnabled 
java_command: ApacheJMeter.jar
java_class_path (initial): ApacheJMeter.jar
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Amazon\cfn-bootstrap\
USERNAME=XXX
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 85 Stepping 4, GenuineIntel

由于 OutOfMemoryError,我最近不得不增加 Java 所有从机和服务器机器的堆大小。 所有 10 个从机都有 4GM RAM,服务器机器有 16GM RAM。 当前的 JMeter 设置是:HEAP=-Xms512m -Xmx3276m

您正在使用 Java 8,但仍在使用旧的 JMeter 3.1 版本,

请尽量使用最新的Version 5.0 which is the first listed in JMeter best practices,同时针对你的问题,尽量减少资源:

  • Use non-GUI mode: jmeter -n -t test.jmx -l test.jtl
  • Use as few Listeners as possible; if using the -l flag as above they can all be deleted or disabled.
  • Don't use "View Results Tree" or "View Results in Table" listeners during the load test, use them only during scripting phase to debug your scripts.
  • Rather than using lots of similar samplers, use the same sampler in a loop, and use variables (CSV Data Set) to vary the sample. [The Include Controller does not help here, as it adds all the test elements in the file to the test plan.]
  • Don't use functional mode
  • Use CSV output rather than XML
  • Only save the data that you need
  • Use as few Assertions as possible Use the most performing scripting language (see JSR223 section)

不是JMeter崩溃,而是JVM崩溃。

您的配置有很多问题:

你有这个:

-Xms512m -Xmx3276m -XX:NewSize=128m -XX:MaxNewSize=128m

因为你的调整是错误的,请删除那些:

-XX:NewSize=128m -XX:MaxNewSize=128m

还要检查您是否是 运行 同一台机器上的 10 个从属:

(heap+metaspace size + Number of threads x Stack size) x 10 + 300m < Machine memory size

你说每个从站有 5 个线程,为什么要对这么少的从站进行分布式测试? JMeter 能够在一台普通机器上运行 1000 个线程而不会出现问题。

最后,升级你的 jmeter 非常旧的版本。