Performance testing jmeter


Published on

Published in: Technology
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Performance testing jmeter

  1. 1. Performance TestingJmeter 2.6The load testing toolBy Bhojan Rajan
  2. 2. What is Performance testing? Performance testing is an non-functional testing performed to determine howa system performs in terms of responsiveness and stability under a particularworkload. It can also serve to investigate, measure, validate or verify other qualityattributes of the system, such as scalability, reliability and resource usage GOAL/OBJECTIVE IS TO FIND THE BOTTLE NECK IN THE SYSTEM
  3. 3. What are the types of Performance Testing?Load/Capacity Testing Stress Testing Volume Testing Endurance/Soak Testing Spike Testing
  4. 4. Load / Capacity TestingLoad testing is the simplest form of performance testing. A load test is usuallyconducted to understand the behavior of the system under a specific expected load.This load can be the expected concurrent number of users on the applicationperforming a specific number of transactions within the set duration. This test will giveout the response times of all the important business critical transactions. If thedatabase, application server, etc. are also monitored, then this simple test can itselfpoint towards any bottlenecks in the application software
  5. 5. Bottle neckA bottleneck is a phenomenon where the performance or capacity of an entire systemis limited by a single or limited number of components or resources.Your web application can consist of several modules used to process request. If oneof them has technical limitation, it limits the performance of the whole systemBottleneck in the application can be identified by performing the load test with thedefined concurrent user load for various scenarios.
  6. 6. Stress TestingEvery system has a capacity limit. When the load goes beyond the limit, the web sitestarts responding very slowly and even produce errors.The purpose of the stress testing is to find the capacity limit of the system. In we canverify at which point of time the system degrades or fails. Usually done by increasingthe user load in the system.
  7. 7. Volume TestingVolume testing is done against the efficiency of the application. Huge amount of datais processed through the application (which is being tested) in order to check theextreme limitations of the system.The limitation will be concluded upon the slow in the system performance and thefailure in the application.
  8. 8. Endurance TestingThis type of testing is used to check that the system can withstand the load for a longor large number of transaction.Test will be performed with defined set of concurrent users for a prolonged period oftime, say for example 5 to 10 hours or 2 to 3 days.
  9. 9. Spike TestingSpike testing is done by suddenly increasing the number of load generated by, usersby a very large amount and observing the behavior of the system. The goal is todetermine the performance degrade, system failure or it will be able to handledramatic changes in load.Say for example, test will be initiated with 200 concurrent user for a certain period oftime, suddenly the concurred user load will be increased to 1000 and the systemperformance will be monitored. Like wise the user load will be decreased to 200concurrent users and verify the system returns to normal operation and retaining theperformance as initiated.
  10. 10. Pre-requisites• NFR document should be available – It will provide you the expected Response time and required Concurrent user load, Scenarios to be tested and other performance attributes.• Dedicated Performance test environment should be ready in place.• Scalability on the test environment to the actual production environment should be available.• Gather the environment details like App, Web and DB servers configurations and their capacity.• Performance Test approach document should be ready and sing-off from the stake holders.
  11. 11. Load Testing Toolso Load Runner, commercial load testing tool from HPo JMeter, an open source tool from Appacheo RPT, commercial load test tool from IBMo NeoLoad, commercial, for Windows, Linux, Solariso Microsoft Visual Studio Team System 2010, commercial, for Windows, which includes Load Test Analyzer and Load Test Monitor tools.o OpenLoad, commercial load testing tool and hosted serviceo OpenSTA, an open source toolo PureLoad, commercial, multiplatform load testing toolo PushToTest TestMaker, an open source testing framework (load testing and more)o QEngine, free and commercial, from AdventNet (free edition supports 5 virtual users)o SQLQueryStress Performance Testing Tool, free, for testing SQL Server StressIT, commercial and freeo The Grinder, an open source toolo Flood, open source from and for Apacheo WAPT, Web Application Testing tool, a commercial product, for Windowso WatchMouse, commercial hosted load testing serviceo WebKing, commercial, multiplatformo WebServer Stress Tool, commercial and free, from Paessler
  12. 12. Why JMeter? It is an Open source tool. Can load and performance test many different server types:  Web - HTTP, HTTPS  SOAP  Database via JDBC  LDAP  JMS  Mail - POP3(S) and IMAP(S) User friendly GUI Design compare to other tools. Full multithreading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups. Caching and Cookies can be enabled and it impact as such as it is executing in the web browser. Controllers are configurable and can monitor the server performance. Test results are more reliable compare to other open source tools. Test results can be captured in various format like summary report, Graph, Aggregate report, Aggregate graph, Results in tree and Results in Table.
  13. 13. Installing Jmeter• Install Java (2.2. or higher)• Download JMeter• Add path of java installation in environment path variables.
  14. 14. Running JMeter In Windows Open command prompt (user administrative mode to avoid unnecessary hassle). Traverse to [jmeter installation path]bin Run Jmeter.bat
  15. 15. Elements of Test Plans• Thread Group – Setup number of thread – Set up ramp up period – No. of times test executes• Controllers – Sampler (Send Request to Server) – Logical Controller (Customize logic to send request)• Listener – Graph Result – View Results Tree and many more.• Timers – Delay next request for certain amount of time Continue….
  16. 16. Elements of Test Plans• Assertions – Allow you to assert fact about responses received from HTTP request• Configuration Elements – Allow you configure settings• Preprocessor – Execute prior to sampler request• Post Processor – Execute some action after sampler request
  17. 17. Creating web test plan
  18. 18. Creating web test plan
  19. 19. Creating web test plan
  20. 20. Adding users• 5 users send 2 requests on and repeat it twice. (5 users x 2 requests x 2 repeat = 20 requests)• Right click on test note >> Add >> Thread (users) >> Thread Group
  21. 21. Add default http request• You can add default http request setting from ADD >> Config Element >> HTTP request default.• This will let you define default http parameter for every request.
  22. 22. Adding HTTP Request element• You can add it from ADD> Sampler >> HTTP Request
  23. 23. Adding Listner to view Result• Listner responsible for storing all of the results of our HTTP request and presenting in Visualize mode.
  24. 24. DEMO
  25. 25. Graph Comparison (5 Users VS 50 Users) 5 Users 50 Users
  26. 26. Test Summary 5 Users 50 Users
  27. 27. Recording your Test Plan
  28. 28. Recording Your Test Plan• JMeter Proxy can use to record all request send to server.• Create test plan with default http testing• Add HTTP Proxy Server in Workbench node. – Define port# of proxy server – Define URL Pattern to include/exclude • .*.jpg • .*.js • .*.png • .*.gif • .*.jsp • .*.css • .*.txt • .*.ejs • .*.eot• Start Proxy server.
  29. 29. Recording Your Test Plan• Setup Proxy server on your browser.• Start Recording using the Web Browser.• All the Request will be captured in the Test plan.
  30. 30. Controlling request logic• Logic Controllers can be used to control flow.
  31. 31. Parameterization
  32. 32. Parameterization• Create CSV file with list of username and password• Store in same folder where your test stores• Add CSV Data set into your test tree from config elements• Add ${USER},${PASS} in request sampler as parameter.
  33. 33. Correlation
  34. 34. Correlation• Correlation is used to obtain data which is unique for each run of your test script (ex: session ids). While recording, these dynamic values are hard-coded in your script causing the script to fail during playback. Correlation is a technique where dynamic values are not hard-coded in your script but are extracted at run-time to avoid failure• Correlation will be done using the Regular Expression Extractor in Jmeter.Sample of Regular Expression and Usage:• ([^"]+)  to correlate whole url/dynamic id – Ex: Edmiijkn11124mmk• SessionID=(.+?)&  to correlate the url/dynamic id between 2 parameter. Here it’s between ‘SessionID=‘ and ‘&’ Need to be use if – EX: SessionID=jkjoujn434897h3jh35y9h&OrderID=ikikikke99874kmnjhh2• orderID=(.+)  to correlate the url;/dynamic id after the defined parameter. Here it’s after ‘orderID=’ – EX: SessionID=jkjoujn434897h3jh35y9h&OrderID=ikikikke99874kmnjhh2
  35. 35. Correlation - Regular Expression ExtractorRight click the node/url > Add > Post Processor > Regular Expression ExtractorDefining Regular Expression Extractor:Reference name: RegexRegular Expression : ([^"]+)Template : $1$Match no : 1Hint:1. Need to tag/replace the reference name Regex by ${Regex} in the URL /Dynamic Id.2. Regular expression can be done before URL where the Dynamic Id/URL you found.
  36. 36. Correlation
  37. 37. Assertion
  38. 38. Response Assertion• Allow you to assert fact about responses received from HTTP request ADD> Assertion >> Response Assertion
  39. 39. Assertion Result• Assertion result provide you the exact response for the request ADD> Listener >> Assertion Result
  40. 40. Monitor Sever Performance
  41. 41. HTTP Authorization ManagerADD> Config Element >> HTTP Authorization Manager
  42. 42. App/DB/Web Server configurationADD> Sampler >> HTTP Request•Name the http request as Server Status, Provide the server IP and port•Mention “/manager/status” in the path
  43. 43. Constant TimerADD> Timer >> Constant Timer
  44. 44. Setting up the Data WriterADD> Listener >> Simple Data Writer
  45. 45. Setting up monitor resultsADD> Listener >> Monitor Results
  46. 46. Distributed Testing
  47. 47. Distributed Test Environment VM 2 Slave Target VM 3 Slave VM 1 VM 4Master Slave Web Server VM 5 Slave Master: The system running Jmeter GUI which control the test. VM n Slave Slave: The System running Jmeter-server which takes commends from the GUI and send the requests to the target system. Target: The Web Server planned for the load test.
  48. 48. Jmeter Distributed Testing• JMeter client machine may not able to simulate enough users to stress server.• Control multiple machine to run JMeter without copying test samples to different machine.• Configuration: – Copy same version of JMeter to different computer. – Add remote node IP in JMeter.proeprties file. – Run JMeter on remote machine using /JMETER_HOME/bin/jmeter-server (in command prompt) – Start JMeter GUI in host machine. – Select any test plan. – Go to Run >> Remote Start >> Remote IP Address.
  49. 49. DEMO
  50. 50. Thank you
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.