Alexa, tell VoxSnap to play posts from BlazeMeter
How many times have you seen an error on your JMeter load test, indicating you are out or memory?
I’m guessing that most of you have encountered this at least once. Fortunately, there are easy ways to get around it. In this article, I’m going to show you nine ways to get the maximum load on your JMeter test without changing your current hardware setup.
1. Increase the Java Heap Size
The JMeter process runs in the Java Virtual Machine (JVM) under various settings and arguments. The Java Heap Space (as referred to in the error message) is the memory the JVM takes from the underlying operating system to allocate space for the creation of necessary objects.
JMeter’s default configuration (see jmeter.bat for Windows or JMeter for non-Windows systems scripts) assumes a heap space of 512 megabytes only. This is actually pretty low considering many modern smartphones have up to four times more! If your test is running massive objects which go over 512Mb, you’ll get an out of memory error and your test will fail.
Fortunately, there’s a simple solution. Just increase the maximum heap size to ~80% of your total available physical RAM. To do this, find the following line in your JMeter startup script:
HEAP="-Xms512m -Xmx512m"
Now change the -Xmx value accordingly. For example: if you want to set the maximum heap size to 4 gigabytes, you’ll need to change the line to: HEAP="-Xms512m -Xmx4096m"
To apply the change, you’ll need to restart JMeter.
2. Use Up-to-Date Software
Your test might fail if your software is out of date. Make sure you’re using the most recent versions of the following:
1. Java - use the latest 64-bit version of Java SE JDK or Server JRE where possible
2. JMeter - it’s always best to use the latest version of JMeter as the new releases contain performance improvements and bug fixes in addition to any new features.
3. JMeter Plugins (or other 3rd-party libraries) - for the same reasons as Java and JMeter
3. Run Tests in Non-GUI Mode
NEVER run a load test on the JMeter GUI! Use it only for test recording, development, and debugging. JMeter is simply not designed to produce high loads in GUI mode, which means that it will not only freeze - but it will also consume loads of resources and produce unreliable load test results.
I recommend running load tests in the command-line mode, Ant tasks, or Maven plugins - but never the GUI.
4. Use Listeners Wisely
Disable ALL Listeners During the Test Run
Listeners should be disabled during load tests. Enabling them causes additional overheads, which consume valuable resources that are needed by more important elements of your test.
You can open the .jtl results …