Jmeter req / s速率下降,加载org.mozilla.javascript.gen._cmd__

时间:2016-07-13 16:21:55

标签: java performance garbage-collection jmeter

我正在使用Jmeter 3.0进行负载测试。每秒响应代码图表显示了这样一个锯齿图片(50个线程):

enter image description here 尝试使用VisualVM监视java,并且加载的类和gc的图形与之前的相关: enter image description here enter image description here

所以似乎rps只有在完全GC和下降之后才能成长。

我用key -verbose:class>重新启动了Jmeter。 classes.txt可以查看正在加载的类。这个文件大部分内容都包含数千个这样的实体:

[Loaded org.mozilla.javascript.gen._cmd__128239 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128259 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128262 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128261 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128263 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128265 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128266 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128269 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128271 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128270 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128257 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128260 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128273 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128267 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128268 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128280 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128275 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128277 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]
[Loaded org.mozilla.javascript.gen._cmd__128272 from file:/C:/apache-jmeter-3.0/lib/rhino-1.7.7.1.jar]

只有一件有助于保持统一负载的事情是减少堆大小或增加线程数(以更频繁地强制gc)。尝试了不同的java设置,最后一个是:

java -server -XX:+HeapDumpOnOutOfMemoryError -Xms2g -Xmx2g -XX:NewSize=128m -XX:MaxNewSize=512m -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50 -XX:MaxTenuringThreshold=2 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -verbose:class > classes.txt -jar ApacheJMeter.jar 

1 个答案:

答案 0 :(得分:0)

你的答案已经有了原因和解决方案,只是总结一下。

参考文献:  1. Apache JMeter Best Practices  2. 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure