本文介绍了jmeter 测试因内存不足错误而失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试使用 50 个或更多用户运行 jMeter 时,它会给出 OutOfMemoryError:

When try to run jMeter with 50 or more user it gives OutOfMemoryError:

2013/12/18 13:35:15 ERROR - jmeter.threads.JMeterThread: Error processing Assertion  java.lang.OutOfMemoryError: Java heap space
2013/12/18 13:35:15 ERROR - jmeter.threads.JMeterThread: Error processing Assertion     java.lang.OutOfMemoryError: Java heap space
2013/12/18 13:35:15 ERROR - jmeter.threads.JMeterThread: Error processing Assertion  java.lang.OutOfMemoryError: Java heap space
2013/12/18 13:35:15 ERROR - jmeter.threads.JMeterThread: Error processing Assertion  java.lang.OutOfMemoryError: Java heap space
2013/12/18 13:35:16 ERROR - jmeter.threads.JMeterThread: Test failed! java.lang.OutOfMemoryError: Java heap space
2013/12/18 13:35:17 ERROR - jmeter.threads.JMeterThread: Test failed!

我尝试增加堆大小,但仍然出现相同的错误.
即使我试图删除所有听众,但没有任何改变.

I tried to increase the heap size but still getting the same error.
Even i tried to remove all the listeners but nothing changed.

推荐答案

看起来您只是缺少 Java 堆空间.这是正常的,因为默认情况下 JMeter 的堆分配非常低.它可以通过 -Xmx 参数控制.

It looks like that you're just lacking Java Heap Space. It's normal as JMeter by default has a very low heap allocation. It's controllable via -Xmx parameter.

jmeter.batjmeter.sh 脚本中有一行建议启动 JMeter 为

There is a line in jmeter.bat or jmeter.sh script which recommends launching JMeter as

JVM_ARGS="-Xms512m -Xmx512m" jmeter.sh

您可以尝试增加最大堆,直到您不再收到这些错误.我建议将其设置为硬件 RAM 的 80%.

You can try increasing maximum heap until you'll stop receiving these errors. I'd recommend to set it to something like 80% of your hardware RAM.

还要考虑JMeter 性能和调优技巧文章,以确保您禁用内存消耗听众,不要过度编写,有效地使用后处理器等.

Also consider JMeter Performance and Tuning Tips article to make sure that you disable memory-consuming listeners, don't overscript, use post-processors efficiently, etc.

这篇关于jmeter 测试因内存不足错误而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 01:08