Jmeter Tips and Tricks
Jmeter Best Practices
Here are some Jmeter tips that would make your life easier while working with Jmeter.
Generic Tips
Generic Tips
- Use the latest version of Jmeter as each new version has some enhancement in the performance.
- If the Jmeter crashes while running a load test throwing "out of memory error" (error can be seen in Jmeter.log file located in 'bin' folder)
- To resolve this you may need to tweak the Heap size settings (depending on the configuration of the load generating machine)
- The heap setting can be modified in Jmeter.bat (For windows) or Jmeter.sh (for Linux) file "set HEAP=-Xms512m -Xmx1024m"
Below is the list of protocols supported by Jmeter
- Web: HTTP, HTTPS sites 'web 1.0' web 2.0 (ajax, flex and flex-ws-amf)
- Web Services: SOAP / XML-RPC
- Database via JDBC drivers
- Directory: LDAP
- Messaging Oriented service via JMS
- Service: POP3, IMAP, SMTP
- FTP Service
Tips relevant while preparing the scripts
This would help you to see the page view of response received from server during the script recording.
In case of long scripts this simplifies the mapping of the problem request in the test plan to the failing request sampler in Tree view
Open jmeter.properties file and set the property "proxy.number.requests" to true
The property file is present in the bin folder of Jmeter
This is the text you have to modify in the properties file
# Add numeric prefix to Sampler names (default false)
proxy.number.requests=true
Jmeter allows us to define which type of requests to capture[like .jsp, .asp, .php, .html or the like]
for example To set .jsp, enter ".*\.jsp" as an "Include Pattern".
If you are not sure about which requests to capture you can specify the type of requests that should not be captured [like .jpg, .jpeg, .gif]
If this property is not checked, Jmeter will not call the secondary objects in the web page like images, .js, .css etc will not be requested during the test execution
for example a Timer gets executed before the parent sampler
Tips relevant while running the tests
A sample command to run jmeter on Non GUI mode is
jmeter -n -t test.jmx -l test.jtl
Either add "View result tree" with "Only errors" checked
or
Use the "Save response to a file" Post processor with "Only errors" checked.
Save the .jtl during test execution and view the graphs etc by loading the .jtl into test plan once test is complete.
- Add 'View Results Tree' listener during recording as a child of the 'HTTP Proxy Server' (in Version 11 the name is 'HTTP(S) Test Script Recorder')
This would help you to see the page view of response received from server during the script recording.
- Add numeric prefix to sampler names - Helps in script debugging
In case of long scripts this simplifies the mapping of the problem request in the test plan to the failing request sampler in Tree view
Open jmeter.properties file and set the property "proxy.number.requests" to true
The property file is present in the bin folder of Jmeter
This is the text you have to modify in the properties file
# Add numeric prefix to Sampler names (default false)
proxy.number.requests=true
- Add a Filter to the type of requests to be captured during recording.[this will reduce the size of your scripts and will simplify our tasks during debugging]
Jmeter allows us to define which type of requests to capture[like .jsp, .asp, .php, .html or the like]
for example To set .jsp, enter ".*\.jsp" as an "Include Pattern".
If you are not sure about which requests to capture you can specify the type of requests that should not be captured [like .jpg, .jpeg, .gif]
- Make sure that the "Retrieve all embedded resources" is checked in the HTTP request sampler while running the test so that proper load is simulated on the servers.
If this property is not checked, Jmeter will not call the secondary objects in the web page like images, .js, .css etc will not be requested during the test execution
- Go through the scoping rules to make sure that your scenario runs as expected
for example a Timer gets executed before the parent sampler
Tips relevant while running the tests
- While simulating large number of users Invoke multiple instances of JMeter (the number of threads to run from single instance will depend on the configuration of machines used to run Jmeter)
- To reduce the resource consumption of the load generator machine, the jmeter should be run on-GUI mode
A sample command to run jmeter on Non GUI mode is
jmeter -n -t test.jmx -l test.jtl
- Disable the “View Result Tree” listener to reduce the memory consumption while running the test.
- For capturing the error screenshots during the test executions
Either add "View result tree" with "Only errors" checked
or
Use the "Save response to a file" Post processor with "Only errors" checked.
- Do not include multiple listeners (including graph).
Save the .jtl during test execution and view the graphs etc by loading the .jtl into test plan once test is complete.
Great post mate, thank you for the valuable and useful information. Keep up the good work! FYI, please check these depression, stress and anxiety related articles:
ReplyDelete20 Ways to calm your mind – How to calm your mind
22 Ways To Become More Positive – How To Become Positive
25 Ways To Forget Unwanted Memories – How to Forget a Bad Memory
Top 25 Ways To Reduce Stress – How To Reduce Stress
21 Ways To Get Rid Of Anger – How To Get Rid Of Anger
How to Know When Depression Is Serious
21 Ways To Get Rid Of Anger – Alcohol and Depression
you can also contact me at depressioncure.net@gmail.com for link exchange, article exchange or for advertisement.
Thanks