This is very common to stuck here after creating a scenario and test cases, we need to run using JMeter and we have to fix the value of how many users or threads are allowed to use in JMeter Thread Group. We don't want to throttle either our Load generator or our JMeter instance.So basically, it is needed tweaking in both cases.Otherwise, The output of the test will be worthless and we will lose hours of our time. So here are the things we need to consider:-
- JMeter is a Java tool it runs with JVM. To obtain maximum capability, we need to provide maximum resources to JMeter during execution.First, we need to increase heap size (Inside JMeter bin directory, we get jmeter.bat/sh)
HEAP=-Xms512m –Xmx512m
It means default allocated heap size is minimum 512MB, maximum 512MB. Configure it as per your own PC configuration. Keep in mind, OS also need some amount of memory, so don't allocate all of you physical RAM.
- Then, add memory allocation rate
NEW=-XX:NewSize=128m -XX:MaxNewSize=512m
This means memory will be increased at this rate. You should be careful, because, if your load generation is very high at the beginning, this might need to increase. Keep in mind, it will fragment your heap space inside JVM if the range too broad. If so, Garbage Collector needs to work harder to clean up.
JMeter is Java GUI application. It also has the non-GUI edition which is less resource intensive (CPU/RAM). If we run JMeter in non-GUI mode, it will consume less resource and we can run more thread.
Disable ALL Listeners: During the Test Run. They are only for debugging and use them to design your desired script.
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.
Always try to use the Up-to-date software. Keep your Java and JMeter updated.
Don’t forget that when it comes to storing requests and response headers, assertion results and response data can consume a lot of memory! So try not to store these values on JMeter unless it’s absolutely necessary.
So in summary, if no Listeners are included in JMeter script, no monitoring inside running JMeter server, network overhead/barriers and JMeter scripts are optimized then here is a rough calculation:
The total number of concurrent user = (total allocable memory)/(Size of all requests)
You have to estimate your concurrent number user/thread (active threads) only in terms of your load scenario.
Also, you need to monitor whether your servers Memory consumption
, CPU usages
are running below 80 % or not. If these usages exceed 80 % consider those tests as unreliable as a report.
For better and more elaborate understanding these two blogs How many users JMeter can support? and 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure must help.