Optimization of JMeter JVM for Load testing

JMeter Architecture: JMeter is a Java desktop application with a graphical interface that uses the Swing graphical API. It can therefore run on any environment / workstation that accepts a Java virtual machine, for example − Windows, Linux, Mac, etc.

JMeter Version and Machine details: JMeter 5.4 is used for analysis, window 10,8GB RAM ,JDK 1.8,One JMX test scenario

JVM runtime flag usage is demonstrated which can be used to enhance JMeter capacity in dedicated machine infrastructure.

To tune the code cache size: JVM flag to use: XX:+PrintCodeCache

JMeter test is performed in CLI mode and command line to write as per below

java -XX:+PrintCodeCache -jar ApacheJmeter.jar -JThread=1 -JPeriod=2 -Jtime=60 -n -t correlations.jmx -l result1999.jtl

In case of VM warning: Code cache is full we can use below flag to increase the initial code size:

-XX:InitialCodeCacheSize=100m where m represents megabyte k represents kb and g gigabite.

It is just for reference purpose and not required to tune this parameter.

To tune Heap Size of JMeter JVM:JVM flag to use -Xms1g can also represent -XX:InitialHeapSize=1g, -Xmx1g can also represent as -XX:MaxHeapSize=1g

Example of induced Out of Memory exception:

java -XX:MaxHeapSize=10m -jar ApacheJmeter.jar -JThread=1000 -JPeriod=2 -Jtime=160 -n -t correlations.jmx -l result358799.jtl

Scenario is created on small scale infrastructure and maximum heap allocated to 10M only.

Out of memory exception

To increase the Heap Memory with runtime arguments:

java -XX:MaxHeapSize=3g -Xms2g -jar ApacheJmeter.jar -JThread=1000 -JPeriod=2 -Jtime=160 -n -t correlations.jmx -l result358799.jtl

Validation of argument through JConsole which can be found in JDK Bin folder.

JConsole view

Garbage Collection Algorithm Tuning

There are three types of GC_Algo and can be set up by below options.

Serial: -XX:+UseSerialGC

Parallel: -XX:+UseParallelGC

Mostly concurrent: -XX:+UseConMarkSweepGC ,-XX:+UseG1GC

Example of GC algo changes:

java -XX:+UseConcMarkSweepGC -jar ApacheJmeter.jar -JThread=1000 -JPeriod=2 -Jtime=160 -n -t correlations.jmx -l result37099.jtl

To view the changes with help of JMAP utility which is present in JDK bin:

Conclusion : JVM flag can be used to Optimized the test server and best possible can be directly configured in jmeter.bat file.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Manish Tiwari

Manish Tiwari

26 Followers

have over 11 years of experience working in Performance Testing domain. Currently, I work as Infosys Performance Test Lead.