Search code examples
javajmeterheap-size

how to extend HEAP SIZE of jMeter 5.1.1 on Windows 10


I have problem with Heap Size in jMeter and I need to increase the heap size. I try change in jmeter.bat but in console (when I open gui mode) the displayed info is still default option.

How can I extend the heap size in my jMeter? I need step by step information.

My environment is:

  • jMeter 5.1.1
  • Java 8
  • Windows 10.

When I check in gui mode in JSR223 Listener with groovy script

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

In console I see good value what I create in jmeter.bat.

Can I believe in the groovy script info or what is displayed in the console when I open gui mode?

btw. for test I am using non gui mode, but I was be curious which info is true.


Solution

    1. Change your script to use println() function

      java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments().each {
          println("Effective JVM argument: " + "$it")
      }
      
    2. Run your JMeter script in command-line non-GUI mode like

      jmeter -n -t test.jmx
      
    3. You should see default JMeter 5.1.1 heap settings: -Xms1g and -Xmx1g

    4. Now set HEAP environment variable to increase the lower limit to 5G and the upper limit to 10G

      set "HEAP=-Xms5g -Xmx10g"

    5. Re-run your JMeter script - you should see the updated values:

      enter image description here

    6. If you want the change to be permanent you need to amend this line of the jmeter.bat file:

      set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m
      

      to contain whatever values you want