Tips to Optimize the Performance of JMeter and Test Script

  • Increase the capacity of the docker container
  • Improve the performance of JMeter and the running environment

Use Java JDK NOT JRE

  • JRE: Java Runtime Environment. It is basically the Java Virtual Machine where your Java programs run on. It also includes browser plugins for Applet execution.
  • JDK: It’s the full-featured Software Development Kit for Java, including JRE, and the compilers and tools (like JavaDoc, and Java Debugger) to create and compile programs.

Increase JVM Heap Space

-Xms<size>-Xmx<size>

Further Tweak JVM Settings

  • -server: This switches JVM into “server” mode with runtime parameters optimization, as explained above it enables more aggressive compiler optimizations,
  • -XX:+UseConcMarkSweepGC: Enables concurrent Mark Sweep GC which can improve CPU usage on multi-core CPUs,(to see more on GC)
  • -XX:+DisableExplicitGC: Prevents explicit GC Calls. Unfortunately (and in spite of the disclaimers in the documentation), many developers decide they know better than the JVM and call the Garbage Collector programmatically to collect memory. I’m aware of many instances where the -XX:+DisableExplicitGC improved the production environment and zero instances where there were any negative side effects.

Tune the operating system for optimal performance

# Increase system IP port limits 
net.ipv4.ip_local_port_range = 1024 65535
# Decrease TIME_WAIT seconds
net.ipv4.tcp_fin_timeout = 60
# Increase system file descriptor limit
fs.file-max = 2097152
# Reuse TIME_WAIT sockets faster
net.ipv4.tcp_tw_reuse = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 0
# The maximum number of "backlogged sockets""
net.core.somaxconn = 1024
* soft nofile 65535* hard nofile 65535

Upgrade Java and JMeter

  • Java: use the latest 64 bits Java Virtual Machine, as it allows to use of more than 1536 MB or RAM as Xmx,
  • JMeter: latest JMeter versions usually contain many fixes and improvements,
  • JMeter Plugins: make sure to use the latest JMeter Plugins,
  • Operating System: upgrade your operating system to the latest version.

JMeter Non-Gui Mode

  • -n: runs JMeter in non-GUI mode,
  • -t: specifies the path to source .jmx script to run.

Disable Listeners

  • View Results in Table => OutOfMemory guarantee in GUI Mode
  • View Results in Tree => OutOfMemory guarantee in GUI Mode
  • Graph Results => Performance issues
  • Assertion Results => OutOfMemory guarantee
  • Comparison Assertion Visualizer
  • Distribution Graph (alpha) => Performance issues
  • Graph Results => Performance issues

Tune JMeter SaveService

# true when field should be saved; false otherwise# assertion_results_failure_message only affects CSV output
#jmeter.save.saveservice.assertion_results_failure_message=true
# legitimate values: none, first, all
#jmeter.save.saveservice.assertion_results=none
#jmeter.save.saveservice.data_type=true
#jmeter.save.saveservice.label=true
#jmeter.save.saveservice.response_code=true
# response_data is not currently supported for CSV output
#jmeter.save.saveservice.response_data=false
# Save ResponseData for failed samples
#jmeter.save.saveservice.response_data.on_error=false
#jmeter.save.saveservice.response_message=true
#jmeter.save.saveservice.successful=true
#jmeter.save.saveservice.thread_name=true
#jmeter.save.saveservice.time=true
#jmeter.save.saveservice.subresults=true
#jmeter.save.saveservice.assertions=true
#jmeter.save.saveservice.latency=true
# Only available with HttpClient4
#jmeter.save.saveservice.connect_time=true
#jmeter.save.saveservice.samplerData=false
#jmeter.save.saveservice.responseHeaders=false
#jmeter.save.saveservice.requestHeaders=false
#jmeter.save.saveservice.encoding=false
#jmeter.save.saveservice.bytes=true
# Only available with HttpClient4
#jmeter.save.saveservice.sent_bytes=true
#jmeter.save.saveservice.url=false
#jmeter.save.saveservice.filename=false
#jmeter.save.saveservice.hostname=false
#jmeter.save.saveservice.thread_counts=true
#jmeter.save.saveservice.sample_count=false
#jmeter.save.saveservice.idle_time=true

Distributed Tests

Transactions Per Minute
Processed Bytes in the back-end

--

--

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
Dilshan Fernando

Dilshan Fernando

Quality Engineering | Test Automation Engineer | AWS Certified Solutions Architect | Problem Solver