Jmeter,如何增加堆大小 [英] Jmeter, how to increase heap size

查看:439
本文介绍了Jmeter,如何增加堆大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经读到您需要更改jmeter.bat文件(我正在使用Windows)中的堆大小以增加内存,以便能够测试大约500个或更多线程.这是默认设置:

I had read that you need to change the heap size in the jmeter.bat file (I'm using windows) to increase the memory to be able to test around 500 threads or more. This is the default:

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时,命令行窗口中会出现一条消息

But when I open Jmeter in GUI mode there is a message in the command line window

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

这是否意味着批处理文件中的更改不起作用?还是在非GUI模式下运行可以正常工作?我错过了要更改的东西吗?提前致谢.

So does that mean the change in the batch file didn't work? Or it does work when running in non-gui mode? Did I miss something to change or what? Thanks in advance.

推荐答案

  1. 除非遇到 java.lang.OutOfMemoryError: Java heap space错误或检测到异常高的 GC 活动
  2. 该消息基本上是一种建议形式,即使您有几TB的堆空间,您也会看到它,因为它是 JSR223采样器以及以下 Groovy 代码:

  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:

这篇关于Jmeter,如何增加堆大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆