Jmeter,如何增加堆大小

4

我曾经读到过,要增加内存以便测试500个以上线程,需要在 jmeter.bat 文件中更改堆大小(我使用的是Windows)。以下是默认值:

if not defined HEAP (
    rem See the unix startup file for the rationale of the following parameters,
    rem including some tuning recommendations
    set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m
)

我将 set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m 修改为:

set HEAP=-Xms2g -Xmx8g -XX:MaxMetaspaceSize=512m

但是当我以GUI模式打开Jmeter时,命令行窗口中会出现一条消息。

Modify current env variable HEAP="-Xms1g -Xmx1g -XX:MaxMetaSpaceSize=256m" in the jmeter batch file

那这是不是代表批处理文件的更改没有生效?或者仅在非 GUI 模式下运行时才有效?我是不是错过了某些需要更改的内容?提前感谢您。
1个回答

5
  1. You don't need to increase the heap unless you face java.lang.OutOfMemoryError: Java heap space error or detect unusually high GC activity
  2. The message basically a form of advice, you will see it even if you have several terabytes of heap space as it is simply hard-coded and will always be shown during GUI startup. If you want to see all Java arguments including heap space settings you can use JSR223 Sampler and the following Groovy code:

    java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments().each {
        log.info("Effective JVM argument: " + "$it")
    }
    

    This way you can test whether you changes are applied or not:

    enter image description here


刚刚查看了一下,是的它显示了我设置的堆大小,谢谢! - Jeffrey Aquino

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接