Search code examples
javaperformancejmeterjvmperformance-testing

Tuning Apache Jmeter for Increased Request Throughput


I currently need to execute a test with apache Jmeter that makes 400 requests per second. To achieve this I have configured a Constant Throughput Timer to 12000 requests per minute (active for all threads in current thread group) and am executing the test from two test servers, each with 32G memory.

The test runs fine at 400tps total for around 15/20 minutes (I am trying to get a run of over an hour) at which point the throughput decreases - sitting at 280 tps when the test finishes.

Are there any tuning parameters or considerations I can take into account when running the test? I have included an example of the heap sizing in my jmeter.bat file.

set HEAP=-Xms1024m -Xmx25600m
set NEW=-XX:NewSize=2048m -XX:MaxNewSize=2048m
set SURVIVOR=-XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=50%
set TENURING=-XX:MaxTenuringThreshold=2
set GC=-XX:+UseConcMarkSweepGC
rem Java 8 remove Permanent generation, don't settings the PermSize
if %current_minor% LEQ "8" (
    rem Increase MaxPermSize if you use a lot of Javascript in your Test Plan :
    set PERM=-XX:PermSize=64m -XX:MaxPermSize=128m
)

I'm using Jmeter ver 3.1. It's worth noting there is a large amount of javascript used to facilitate restrictions to the percentage of threads making certain requests. There is a decent amount of beanshell running and some Groovy also.

Any help is appreciated, a quick google doesn't seem to turn up much around this issue.

EDIT: Included a graph of test throughput HERE


Solution

    1. Try switching to Groovy from JavaScript and Beanshell, as per JMeter Best Practices:

      Since JMeter 3.1, we advise switching from BeanShell to JSR223 Test Elements (see JSR223 section below for more details), and switching from __Beanshell function to __groovy function.

    2. Run your test using profiler tool telemetry, at least JVisualVM or better something like YourKit to see what are the most resource consuming classes, largest objects, how does GC behave

    3. Try switching to G1 Garbage Collector, something like:

      -XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:G1ReservePercent=20
      

      should be a good start

    4. Consider using Weighted Switch Controller for workload distribution as Java solution in any case will be better than any scripting option in terms of performance and resources consumption.