Интересная статья описывающая основные проблемы с jmeter и способы их решения
ЗЫ Многие вещи подтвержденны мной лично на практике, но к сожалению до прочтения этой статьи :)
JMeter Performance and Tuning Tips
Posted by Philippe Mouawad Dec 26, 2012
Recently, we came across a great, informative article on JMeter and wanted to share it with our readers. So, many thanks to Philippe Mouawad for graciously allowing us to repost.
JMeter Performance and Tuning Tips
Context
- JMeter consumes a lot of memory...
- JMeter generates OutOfMemory...
- JMeter consumes a lot of CPU...
- JMeter can only cope with 100 threads and not much more...
- JMeter is fine for playing but once it becomes serious use another tool :-)
- etc.,etc,....
- to issues that have been fixed for a while now
- and partly in my opinion to some default configuration parameters that lead to these issues
- misuse of elements that are to be used during scripting and never during Load Test
JMeter Performance Basic concepts
- The more it computes to create or process your samples, the less time it spends sampling, so when doing custom coding, ensure it is efficient
- Listeners receive Sample Results and do some processing with it, this takes resources (memory, CPU) so during Load Testing, a very simple rule is to REMOVE ALL LISTENERS!, you will ask How can I use my results then?, the answer is, you will do it after the run.
So NEVER EVER have one of these listeners in your Test Plan during a Load Test:- View Results in Table => OutOfMemory guarantee
- View Results in Tree => OutOfMemory guarantee
- Graph Results => Performance issues
- Assertion Results => OutOfMemory guarantee
- Comparison Assertion Visualizer
- Distribution Graph (alpha) => Performance issues
- Graph Results => Performance issues
Performance Checklist
Always use the last version of JMeter
- http://wiki.apache.org/jmeter/JMeterPerformance
- https://issues.apache.org/bugzilla/show_bug.cgi?id=54268 (fixed in 2.9)
Use NON-GUI for Load Test
- GUI mode is for creating the test plan, checking it, debugging it BUT NOT FOR MASSIVE LOAD TEST. AWT Event Thread will disrupt your Load Test.
- NON-GUI mode is for massive load testing, it is as simple as:
<JMETER_HOME>/bin/jmeter -t <Path to Test Plan> -n -l <path to results>/results.csv
Configure JMeter Java options to meet your requirements
- Default JMeter java configuration comes with 512 Mo and very little GC tuning.
- First ensure you set -Xmx option value to a reasonable value regarding your test requirements.
- Then change MaxNewSize option in jmeter file to respect the original ratio between MaxNewSize and -Xmx.
- Finally try tuning GC options only if you master this domain.
Use CSV as output for SaveService
So, in user.properties, add:
Use Post-Processor and Assertion efficiently
Use Regular Expression Extractor
- Body
- Headers
- URL
- Response Code
- Response Message
Avoid XPath Extractor when possible
Use Response Assertion or Size assertion
- XML Assertion
- XML Schema Assertion
- XPath Assertion
Use JSR 223 + Groovy for Scripting
- Beanshell
- BSF and all supported languages Javascript, Scala , Groovy, Java ...
- JSR223 and all supported languages Javascript, Scala , Groovy, Java ...
Using Groovy is as simple as adding groovy-VERSION-all.jar in <JMETER_HOME>/lib folder.
Generate Reports AFTER the Run
- Aggregate Graph
- Response Time Graph
- JMeter Plugins graphs
Distributed (Remote) Testing
- remove some data from the SampleResults as the response body, but do you need response body during a High Load Test, NO, DEFINITELY NO !
- will send Sample Results as Batches and not for every sample reducing CPU, IO and network roundtrips
About the Author
Philippe Mouawad works as an Architect and technical expert for Ubik-Ingenierie where he leads the development of Commercial Apache JMeter based Plugins for RIA and Ajax technologies (GWT, Flex). Philippe is also a committer on the Apache JMeter project and member of the PMC since October 2011.
*This article is reprinted with permission from Philippe Mouawad and Ubik-Ingenierie. (Original posting December 24, 2012 http://www.ubik-ingenierie.com)