The Blog is a series of articles about performance/Load/Stress testing It covers all the phases of a performance testing cycle starting from requirement gathering to bottleneck identification and Performance Re-engineering. We will also try to cover multiple tools (Jmeter, LR, RPT, VSTS, SOAP UI etc) and technologies (Like SOA, .net, Java etc) Some more Posts will be uploaded soon :)

Total Pageviews

Powered by Blogger.

Follow by Email

Recent

Comment

Search This Blog

Followers

Saturday, December 20, 2014

Jmeter Tips and Tricks



Jmeter Best Practices



Here are some Jmeter tips that would make your life easier while working with Jmeter.

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


  • 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.

3 comments:

  1. It’s very useful site for learn. This information’s are very helpful to us. It will improve my knowledge. Thank you for sharing this wonderful site.
    Performance testing training in Chennai | LoadRunner Training Institute in Chennai | HP LoadRunner Training in Chennai | LoadRunner Classes in Chennai

    ReplyDelete

  2. This is an awesome post. Really very informative and creative contents.
    WordPress website development Chennai

    ReplyDelete