简体   繁体   中英

Jmeter, how to increase heap size

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
)

I changed the set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m it to:

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

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

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. 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:

    在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM