Best Practices for JMeter Test Execution

Best Practices for JMeter Test Execution

Apache JMeter is an open-source tool which is widely used for Performance Testing. The test execution through the JMeter tool is an easy task, but the execution steps also have some best practices to avoid misconfiguration and help to get accurate results. These best practices are listed below:

  1. Execution Mode: Apache JMeter has 3 launching or execution modes which are well described in the past article. Refer to the article link. The best-recommended mode for the performance test is Non-GUI mode, also called Command Line Interface mode and commands are
    For Windows: jmeter -n -t <script name with path> -l <log file name with path>
    For Unix: ./jmeter.sh -n -t <script name with path> -l <log file name with path>
  2. Avoid Listener: Do not use any listener. It degrades the performance of the JMeter. You can use the .jtl file as a test log, created using -l argument in non-GUI mode.
  3. Log Level Configuration: If you want to run the test in debug mode i.e. if you want to capture the logs for debugging purposes then set up the listener to capture the log only when the error occurs.
  4. Optimize Correlation: Do not use multiple correlations to capture the same values from the different requests. Also, make appropriate use of the -1 or 0 option, only if required while capturing the dynamic value. Use JSON Extractor or RegEx Extractor instead of Boundary Extractor. JSON Extractor is more memory efficient than the other two.
  5. Avoid Direct DB connection: Do not fetch the test data from the Database in each iteration. It will create an additional connection on the DB and also impact to overall TPS. The best way is to fetch the test data once and save it in a file using set-up Thread Group and use the fetched test data from that file in the regular Thread Group.
  6. Function Mode: Always disable the option ‘Functional Test Mode (i.e. save Response Data and Sampler Data) while running the load test. This option is recommended only for debugging purposes.
  7. Parametrization: Use CSV Data Set Config for parameterization. Re-check twice all the settings under ‘CSV Data Set Config’ to avoid the test termination condition.
  8. Global Assertion: Do not use global assertion for generic errors which can be easily errored out by HTTP code. The global assertion compares every response. Also, do not apply over assertions, it degrades the performance of the JMeter.
  9. Scripting Language: Try to use JSR223 + Groovy to make JMeter memory efficient rather than using BeanShell elements.
  10. HTML Reporting: Avoid generating the HTML report at the end of the test along with the run. Sometimes JMeter is unable to generate the report.
  11. Sanity Test: Always do a low-load sanity test before running the actual performance test.
  12. Pre-checks: It is a good habit to check the space in the load generator machine, test set-up, external file path and configuration before starting the test.
  13. Distributed Mode: Make sure all the machines i.e. master and slaves must have the same JMeter version, File path and network connectivity to the application. Refer to the link to get more information on Distributed Mode.

You may be interested:


Leave a Comment