SlideShare a Scribd company logo
1 of 69
© Copyright GlobalLogic 2008
Jmeter
2
© Copyright GlobalLogic 2008
• What is Load Testing???
– Load and performance testing is to test software intended for
a multi-user audience for the desired performance by
subjecting it with an equal amount of virtual users and then
monitoring the performance under the specified load, usually
in a test environment identical to the production environment,
before going live
3
© Copyright GlobalLogic 2008
Load Testing
Key goals
Can app support expected concurrent users?
At what load does the app break?
Steps followed
Identify primary user paths
Identify expected concurrent users. Both now and down the
road
Set up virtual users to hit the app
Run the test
Analyze the results
4
© Copyright GlobalLogic 2008
Load Testing Approaches
Open Source Tools
JMeter
ab
http_load
The Grinder
Siege
Commercial Tools
LoadRunner (around $200,000 to own!)
WebLoad
Third-party $ervices
5
© Copyright GlobalLogic 2008
Why We Chose JMeter for Internal Testing
Easy to install and use
Free!
Java — most platforms
Just download and run!
• Feature-rich
– Post forms
– Record from browser
– Load test data from files
– Add logic, variables & functions
– Run one test from multiple machines
– Test many protocols, not just HTTP
6
© Copyright GlobalLogic 2008
• JMeter's Nomenclature
– User -> Thread
– Request -> Sampler
– Report -> Listener
7
© Copyright GlobalLogic 2008
Test Plan
Test Plan
• The Test Plan is where the overall settings for a test are specified.
• Static variables can be defined for values that are repeated throughout a test, such as
server names. And can be accessed by the $(server) variable inside the test plan.
• Selecting Functional Testing instructs JMeter to save the additional sample information -
Response Data and Sampler Data - to all result files. This increases the resources needed
to run a test, and may adversely impact JMeter performance.
8
© Copyright GlobalLogic 2008
Thread Group
Thread Group: A Thread Group defines a pool of users that will execute a particular test
case against your server. In the Thread Group GUI, you can control the number of users
simulated (num of threads), the ramp up time (how long it takes to start all the threads),
the number of times to perform the test, and optionally, a start and stop time for the test.
9
© Copyright GlobalLogic 2008
Configuration Element
10
© Copyright GlobalLogic 2008
Sampler
CSV Data Set Config: CSV Data Set Config is used to read lines from a file, and split them
into variables. By default, the file is only opened once, and each thread will use a different
line from the file. Lines are read at the start of each test iteration. The file name and mode
are resolved in the first iteration.
11
© Copyright GlobalLogic 2008
HTTP Cookie Manager: It stores and sends cookies just like a web browser. If there
is an HTTP Request and the response contains a cookie, the Cookie Manager
automatically stores that cookie and will use it for all future requests to that particular web
site. Each JMeter thread has its own "cookie storage area". So, if you are testing a web
site that uses a cookie for storing session information, each JMeter thread will have its
own session. Received Cookies are stored as JMeter thread variable.
Cookie stored in the Cookie Manager: This gives you the opportunity to use hardcoded
cookies that will be used by all threads during the test execution. Not Recommended.
12
© Copyright GlobalLogic 2008
HTTP Request Default:
13
© Copyright GlobalLogic 2008
• Result of HTTP Request Default:
14
© Copyright GlobalLogic 2008
User Defined Variable:
15
© Copyright GlobalLogic 2008
• Result of UDV
16
© Copyright GlobalLogic 2008
FTP Request Default:
17
© Copyright GlobalLogic 2008
JDBC Connenction Configuration
18
© Copyright GlobalLogic 2008
Controllers
19
© Copyright GlobalLogic 2008
Simple Controller
The Simple Logic Controller lets you organize your Samplers and other Logic Controllers.
Unlike other Logic Controllers, this controller provides no functionality beyond that of a
storage device
20
© Copyright GlobalLogic 2008
Simple Controller result:
21
© Copyright GlobalLogic 2008
Loop Controller: Loop Controller in JMeter will loop through the
request defined under it certain number of times, in addition to the
loop value specified for the Thread Group.
22
© Copyright GlobalLogic 2008
Results of Loop Count Controller: It will iterate through the
samplers as given in Loop Count.
23
© Copyright GlobalLogic 2008
Once only Controller: The Once Only Logic Controller tells JMeter
to process the controller(s) inside it only once,and pass over any
requests under it during further iterations through the test plan. If
it is defined under loop controller having Loop Count = 3, it will
execute the sampler under once only controller once.
24
© Copyright GlobalLogic 2008
Once Only Controller.
• Results of Once only Controller: Loop Count under Loop
controller is defined to be 3. But once only controller
executes sampler under it once. But Once only controller
have no effect on Loop count defined under thread Group.
25
© Copyright GlobalLogic 2008
Include Controller
• The include controller is designed to use an external jmx file.
• To use it, add samples to a simple controller, then save the simple controller as a
jmx file.
Logic Controller
26
© Copyright GlobalLogic 2008
Logic Controller
Include Controller contd…
27
© Copyright GlobalLogic 2008
Runtime Controller: The Runtime Controller controls how long its
children are allowed to run.
28
© Copyright GlobalLogic 2008
If Controller: The If Controller allows the user to control whether the
test elements below it (its children) are run or not.
Condition: Conditions are given to make sure that all the samplers
below if controller are executed only when condition is met.
Evaluate for all children: Evaluate for all children, is given to
evaluate condition for all children. Otherwise it is evaluated at the
entry point
29
© Copyright GlobalLogic 2008
Results of thread group:
Thread group = 2
30
© Copyright GlobalLogic 2008
Results: Note that as per condition sampler1 is executed for
both the thread group but, samplers under if controller are
executed only for thread 2.
31
© Copyright GlobalLogic 2008
Module Controller: The Module Controller provides a mechanism
for substituting test plan fragments into the current test plan at
run-time.
A test plan fragment consists of a Controller and all the test
elements (samplers etc) contained in it. The fragment can be
located in any Thread Group, or on the WorkBench . If the
fragment is located in a Thread Group, then its Controller can be
disabled to prevent the fragment being run except by the Module
Controller. Or you can store the fragments in a dummy Thread
Group, and disable the entire Thread Group.
32
© Copyright GlobalLogic 2008
Module Controller contd..
Module to Run: The module controller provides a list of all
controllers loaded into the gui. Select the one you want to
substitute in at runtime.
33
© Copyright GlobalLogic 2008
As the other controllers are not made deactive so all controllers
have been executed once. Under Module controller Simple
Controller have been placed. Simple Controller have been
executed twice.
34
© Copyright GlobalLogic 2008
Timers
35
© Copyright GlobalLogic 2008
Constant Timers: To pause each thread for the same amount of
time Constant timer is used.
Timer can be added as a child to thread group or as a child to
sampler. If added to thread group it will delay the entire
thread group for the time specified. And if it is added to
sampler then it will delay the sampler by the given amount of
time.
36
© Copyright GlobalLogic 2008
Uniform Random Timer: This timer pauses each thread request
for a random amount of time, with each time interval having
the same probability of occurring. The total delay is the sum
of the random value and the offset value.
Total Delay = Offset + Random Delay.
37
© Copyright GlobalLogic 2008
• Synchronizing Timer: The purpose of the SyncTimer is to block
threads until X number of threads have been blocked, and then
they are all released at once. A SyncTimer can thus create large
instant loads at various points of the test plan.
38
© Copyright GlobalLogic 2008
39
© Copyright GlobalLogic 2008
Synchronization timer(contd):
In the above slide Random timer is kept to ensure that all the
threads are delayed by random amout of time. Each thread is
delayed by 3 to 13 seconds.
Synchronization timer is used to make sure that all the desired no. of
threads hit simultaneously at a link. So that the response of the
page can be retrieved. If any thread reaches to the page first it
has to wait for the desired no of threads , so that they all can go
simultaneously to the page.
40
© Copyright GlobalLogic 2008
Pre Processor
41
© Copyright GlobalLogic 2008
A Pre-Processor executes some action prior to a Sampler
Request being made. If a Pre-Processor is attached to a
Sampler element, then it will execute just prior to that
sampler element running. A Pre-Processor is most often
used to modify the settings of a Sample Request just before
it runs, or to update variables that aren't extracted from
response text.
Some of the Pre Processors
1) HTML Link Parser
2) Counters
3) User Parameters
42
© Copyright GlobalLogic 2008
HTML Link Parser: This modifier parses HTML response from
the server and extracts links and forms. A URL test sample
that passes through this modifier will be examined to see if it
"matches" any of the links or forms extracted from the
immediately previous response. It would then replace the
values in the URL test sample with appropriate values from
the matching link or form
43
© Copyright GlobalLogic 2008
44
© Copyright GlobalLogic 2008
Post Processors
45
© Copyright GlobalLogic 2008
Post Processors: A Post-Processor executes some action after a
Sampler Request has been made. If a Post-Processor is
attached to a Sampler element, then it will execute just after that
sampler element runs. A Post-Processor is most often used to
process the response data, often to extract values from it
1) Regular expression extractor
2) XPath Extractor
46
© Copyright GlobalLogic 2008
Regular Expression Extractor
47
© Copyright GlobalLogic 2008
Regular Expression Extractor
48
© Copyright GlobalLogic 2008
Assertion
49
© Copyright GlobalLogic 2008
Assertion: Assertions allow the ability to assert facts about
responses received from the server being tested. Using an
assertion, you can essentially "test" your that your application is
returning the results you expect it to.
1) Response assertion
2) Size assertion
3) Duration assertion
50
© Copyright GlobalLogic 2008
Response Assertion
51
© Copyright GlobalLogic 2008
Results
52
© Copyright GlobalLogic 2008
Functions
53
© Copyright GlobalLogic 2008
Using the functions Helper dialog, from options
54
© Copyright GlobalLogic 2008
Thread Number function
55
© Copyright GlobalLogic 2008
Recording using Jmeter for http request
• 1. start jmeter with jmeter.bat on windows and jmeter.sh on unix
• 2. select “test plan” on the tree
• 3. right click on the “test plan” and add a new thread group: add ->
thread group
• 4. select the thread group
• 5. right click “add -> config element -> Http Request Defaults”
• 6. Protocol – enter “HTTP”
• 7. Server name – enter “jakarta.apache.org”
• 8. Path – leave blank
• 9. Port number – enter “80”
• 10.select workbench
• 11.right click on workbench and add the Http proxy: add -> non-test
elements -> HttpProxy Server
• 12.Port field - Enter “8080”
• Now also set the Browser proxy settings as localhost and port 8080 then
start the test from Jmeter
56
© Copyright GlobalLogic 2008
57
© Copyright GlobalLogic 2008
Browser proxy setting
58
© Copyright GlobalLogic 2008
Listeners
59
© Copyright GlobalLogic 2008
Aggregate Report
60
© Copyright GlobalLogic 2008
Parameters of Aggregate Report
• Label - The label of the sample. If "Include group name in label?" is selected,
then the name of the thread group is added as a prefix. This allows identical
labels from different thread groups to be collated separately if required.
• # Samples - The number of samples for the URL
• Average - The average time of a set of results
• Median - The median is the time in the middle of a set of results. 50% of the
samples took no more than this time; the remainder took at least as long.
• 90% Line - 90% of the samples took no more than this time. The remaining
samples at least as long as this. (90 th percentile)
• Min - The shortest time for the samples of the given URL
• Max - The longest time for the samples of the given URL
• Error % - Percent of requests with errors
• Throughput - Throughput measured in requests per second/minute/hour
• Kb/sec - The throughput measured in Kilobytes per second
• Times are in milliseonds.
61
© Copyright GlobalLogic 2008
Recording from Badboy for Https request
Recording https request from badboy
62
© Copyright GlobalLogic 2008
Badboy test plan after importing to jmeter
63
© Copyright GlobalLogic 2008
Remote Testing
64
© Copyright GlobalLogic 2008
Distributed Test
• It is recommended that we should not run more than 200
threads from one machine, so in order to test for 600 or 1000
users we go for distributed testing
• Master – the system running Jmeter GUI, which controls the
test
• Slave – the system running jmeter-server, which takes
commands from the GUI and send requests to the target
system(s)
• Target – the webserver we plan to load or stress Test
65
© Copyright GlobalLogic 2008
Remote Testing concept
• Before we go ahead with distributed testing, there are a
couple of things to check.
• 1. the firewalls on the systems are turned off.
• 2. all the clients are on the same subnet. 172.16.50.121,
172.16.50.101……..
• 3. the server is in the same subnet, if 192.x.x.x or 10.x.x.x ip
addresses are used. If the server doesn't use 192 or 10 ip
address, there shouldn't be any problems.
• 4. Make sure jmeter can access the server.
• 5. Make sure you use the same version of Jmeter on all the
systems. Mixing versions may not work correctly.
66
© Copyright GlobalLogic 2008
Remote testing steps
• On the slave systems, go to jmeter/bin directory and execute jmeter-server.bat (jmeter-
• server on unix). On windows, you should see a dos window appear with “jre[version]
• binrmiregistry.exe”. If this doesn't happen, it means either the environment settings are
• not right, or there are multiple JRE installed on the system. Note: [version] would be the
• jre version installed on the system.
• 1. Open jmeter-server.bat in a text editor
• 2. go to line 44 and find “:setCP”
• 3. edit “START rmiregistry” to the full path. Example: “START
• C:j2sdk1.4.2jrebinrmiregistry”
• 2. On master system acting as the console, open windows explorer and go to jmeter/bin
• directory
• 3. open jmeter.properties in notepad or wordpad
• 4. edit the line “remote_hosts=127.0.0.1”
• 5. add the IP address. For example, if I have jmeter server running on 192.168.0.10, 11, 12,
• 13, and 14, the entry would like like this:
• remote_hosts=192.168.0.10,192.168.0.11,192.168.0.12,192.168.0.13,192.168.0.14
• 6. Start jmeter.
• 7. Open the test plan you want to use
67
© Copyright GlobalLogic 2008
Distributed Testing architecture
68
© Copyright GlobalLogic 2008
Remote testing
69
© Copyright GlobalLogic 2008
Remote testing
Machine name is different under samplers

More Related Content

Similar to Jmeter.ppt

Software testing
Software testingSoftware testing
Software testing
nil65
 
Performancetestingjmeter 131210111657-phpapp02
Performancetestingjmeter 131210111657-phpapp02Performancetestingjmeter 131210111657-phpapp02
Performancetestingjmeter 131210111657-phpapp02
Nitish Bhardwaj
 
Performance testing jmeter
Performance testing jmeterPerformance testing jmeter
Performance testing jmeter
Bhojan Rajan
 
Jmeter_Presentaion_Parag
Jmeter_Presentaion_ParagJmeter_Presentaion_Parag
Jmeter_Presentaion_Parag
PARAG KHEDIKAR
 
performancetestingjmeter-121109061704-phpapp02
performancetestingjmeter-121109061704-phpapp02performancetestingjmeter-121109061704-phpapp02
performancetestingjmeter-121109061704-phpapp02
Gopi Raghavendra
 
performancetestingjmeter-121109061704-phpapp02 (1)
performancetestingjmeter-121109061704-phpapp02 (1)performancetestingjmeter-121109061704-phpapp02 (1)
performancetestingjmeter-121109061704-phpapp02 (1)
QA Programmer
 
Apachejmeterabriefintroduction
ApachejmeterabriefintroductionApachejmeterabriefintroduction
Apachejmeterabriefintroduction
Foredoomed
 

Similar to Jmeter.ppt (20)

Software testing
Software testingSoftware testing
Software testing
 
JMeter.ppt
JMeter.pptJMeter.ppt
JMeter.ppt
 
Performancetestingjmeter 131210111657-phpapp02
Performancetestingjmeter 131210111657-phpapp02Performancetestingjmeter 131210111657-phpapp02
Performancetestingjmeter 131210111657-phpapp02
 
Performance testing jmeter
Performance testing jmeterPerformance testing jmeter
Performance testing jmeter
 
Jmeter_Presentaion_Parag
Jmeter_Presentaion_ParagJmeter_Presentaion_Parag
Jmeter_Presentaion_Parag
 
J Meter Intro
J Meter IntroJ Meter Intro
J Meter Intro
 
JMeter Intro
JMeter IntroJMeter Intro
JMeter Intro
 
Load Test Drupal Site Using JMeter and Amazon AWS
Load Test Drupal Site Using JMeter and Amazon AWSLoad Test Drupal Site Using JMeter and Amazon AWS
Load Test Drupal Site Using JMeter and Amazon AWS
 
Mastering Distributed Performance Testing
Mastering Distributed Performance TestingMastering Distributed Performance Testing
Mastering Distributed Performance Testing
 
Best Jmeter Interview Questions- Prepared by Working Professionals
Best Jmeter Interview Questions- Prepared by Working ProfessionalsBest Jmeter Interview Questions- Prepared by Working Professionals
Best Jmeter Interview Questions- Prepared by Working Professionals
 
Performance testing with Jmeter
Performance testing with JmeterPerformance testing with Jmeter
Performance testing with Jmeter
 
Basic of jMeter
Basic of jMeter Basic of jMeter
Basic of jMeter
 
Troubleshooting and Best Practices with WSO2 Enterprise Integrator
Troubleshooting and Best Practices with WSO2 Enterprise IntegratorTroubleshooting and Best Practices with WSO2 Enterprise Integrator
Troubleshooting and Best Practices with WSO2 Enterprise Integrator
 
Test talk academy apachejmeter-120521121306-phpapp02
Test talk academy apachejmeter-120521121306-phpapp02Test talk academy apachejmeter-120521121306-phpapp02
Test talk academy apachejmeter-120521121306-phpapp02
 
Top 20 JMeter Interview Questions and Answers in 2023.pdf
Top 20 JMeter Interview Questions and Answers in 2023.pdfTop 20 JMeter Interview Questions and Answers in 2023.pdf
Top 20 JMeter Interview Questions and Answers in 2023.pdf
 
performancetestingjmeter-121109061704-phpapp02
performancetestingjmeter-121109061704-phpapp02performancetestingjmeter-121109061704-phpapp02
performancetestingjmeter-121109061704-phpapp02
 
performancetestingjmeter-121109061704-phpapp02 (1)
performancetestingjmeter-121109061704-phpapp02 (1)performancetestingjmeter-121109061704-phpapp02 (1)
performancetestingjmeter-121109061704-phpapp02 (1)
 
JUnit- A Unit Testing Framework
JUnit- A Unit Testing FrameworkJUnit- A Unit Testing Framework
JUnit- A Unit Testing Framework
 
Performance Tuning Oracle Weblogic Server 12c
Performance Tuning Oracle Weblogic Server 12cPerformance Tuning Oracle Weblogic Server 12c
Performance Tuning Oracle Weblogic Server 12c
 
Apachejmeterabriefintroduction
ApachejmeterabriefintroductionApachejmeterabriefintroduction
Apachejmeterabriefintroduction
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Jmeter.ppt

  • 2. 2 © Copyright GlobalLogic 2008 • What is Load Testing??? – Load and performance testing is to test software intended for a multi-user audience for the desired performance by subjecting it with an equal amount of virtual users and then monitoring the performance under the specified load, usually in a test environment identical to the production environment, before going live
  • 3. 3 © Copyright GlobalLogic 2008 Load Testing Key goals Can app support expected concurrent users? At what load does the app break? Steps followed Identify primary user paths Identify expected concurrent users. Both now and down the road Set up virtual users to hit the app Run the test Analyze the results
  • 4. 4 © Copyright GlobalLogic 2008 Load Testing Approaches Open Source Tools JMeter ab http_load The Grinder Siege Commercial Tools LoadRunner (around $200,000 to own!) WebLoad Third-party $ervices
  • 5. 5 © Copyright GlobalLogic 2008 Why We Chose JMeter for Internal Testing Easy to install and use Free! Java — most platforms Just download and run! • Feature-rich – Post forms – Record from browser – Load test data from files – Add logic, variables & functions – Run one test from multiple machines – Test many protocols, not just HTTP
  • 6. 6 © Copyright GlobalLogic 2008 • JMeter's Nomenclature – User -> Thread – Request -> Sampler – Report -> Listener
  • 7. 7 © Copyright GlobalLogic 2008 Test Plan Test Plan • The Test Plan is where the overall settings for a test are specified. • Static variables can be defined for values that are repeated throughout a test, such as server names. And can be accessed by the $(server) variable inside the test plan. • Selecting Functional Testing instructs JMeter to save the additional sample information - Response Data and Sampler Data - to all result files. This increases the resources needed to run a test, and may adversely impact JMeter performance.
  • 8. 8 © Copyright GlobalLogic 2008 Thread Group Thread Group: A Thread Group defines a pool of users that will execute a particular test case against your server. In the Thread Group GUI, you can control the number of users simulated (num of threads), the ramp up time (how long it takes to start all the threads), the number of times to perform the test, and optionally, a start and stop time for the test.
  • 9. 9 © Copyright GlobalLogic 2008 Configuration Element
  • 10. 10 © Copyright GlobalLogic 2008 Sampler CSV Data Set Config: CSV Data Set Config is used to read lines from a file, and split them into variables. By default, the file is only opened once, and each thread will use a different line from the file. Lines are read at the start of each test iteration. The file name and mode are resolved in the first iteration.
  • 11. 11 © Copyright GlobalLogic 2008 HTTP Cookie Manager: It stores and sends cookies just like a web browser. If there is an HTTP Request and the response contains a cookie, the Cookie Manager automatically stores that cookie and will use it for all future requests to that particular web site. Each JMeter thread has its own "cookie storage area". So, if you are testing a web site that uses a cookie for storing session information, each JMeter thread will have its own session. Received Cookies are stored as JMeter thread variable. Cookie stored in the Cookie Manager: This gives you the opportunity to use hardcoded cookies that will be used by all threads during the test execution. Not Recommended.
  • 12. 12 © Copyright GlobalLogic 2008 HTTP Request Default:
  • 13. 13 © Copyright GlobalLogic 2008 • Result of HTTP Request Default:
  • 14. 14 © Copyright GlobalLogic 2008 User Defined Variable:
  • 15. 15 © Copyright GlobalLogic 2008 • Result of UDV
  • 16. 16 © Copyright GlobalLogic 2008 FTP Request Default:
  • 17. 17 © Copyright GlobalLogic 2008 JDBC Connenction Configuration
  • 18. 18 © Copyright GlobalLogic 2008 Controllers
  • 19. 19 © Copyright GlobalLogic 2008 Simple Controller The Simple Logic Controller lets you organize your Samplers and other Logic Controllers. Unlike other Logic Controllers, this controller provides no functionality beyond that of a storage device
  • 20. 20 © Copyright GlobalLogic 2008 Simple Controller result:
  • 21. 21 © Copyright GlobalLogic 2008 Loop Controller: Loop Controller in JMeter will loop through the request defined under it certain number of times, in addition to the loop value specified for the Thread Group.
  • 22. 22 © Copyright GlobalLogic 2008 Results of Loop Count Controller: It will iterate through the samplers as given in Loop Count.
  • 23. 23 © Copyright GlobalLogic 2008 Once only Controller: The Once Only Logic Controller tells JMeter to process the controller(s) inside it only once,and pass over any requests under it during further iterations through the test plan. If it is defined under loop controller having Loop Count = 3, it will execute the sampler under once only controller once.
  • 24. 24 © Copyright GlobalLogic 2008 Once Only Controller. • Results of Once only Controller: Loop Count under Loop controller is defined to be 3. But once only controller executes sampler under it once. But Once only controller have no effect on Loop count defined under thread Group.
  • 25. 25 © Copyright GlobalLogic 2008 Include Controller • The include controller is designed to use an external jmx file. • To use it, add samples to a simple controller, then save the simple controller as a jmx file. Logic Controller
  • 26. 26 © Copyright GlobalLogic 2008 Logic Controller Include Controller contd…
  • 27. 27 © Copyright GlobalLogic 2008 Runtime Controller: The Runtime Controller controls how long its children are allowed to run.
  • 28. 28 © Copyright GlobalLogic 2008 If Controller: The If Controller allows the user to control whether the test elements below it (its children) are run or not. Condition: Conditions are given to make sure that all the samplers below if controller are executed only when condition is met. Evaluate for all children: Evaluate for all children, is given to evaluate condition for all children. Otherwise it is evaluated at the entry point
  • 29. 29 © Copyright GlobalLogic 2008 Results of thread group: Thread group = 2
  • 30. 30 © Copyright GlobalLogic 2008 Results: Note that as per condition sampler1 is executed for both the thread group but, samplers under if controller are executed only for thread 2.
  • 31. 31 © Copyright GlobalLogic 2008 Module Controller: The Module Controller provides a mechanism for substituting test plan fragments into the current test plan at run-time. A test plan fragment consists of a Controller and all the test elements (samplers etc) contained in it. The fragment can be located in any Thread Group, or on the WorkBench . If the fragment is located in a Thread Group, then its Controller can be disabled to prevent the fragment being run except by the Module Controller. Or you can store the fragments in a dummy Thread Group, and disable the entire Thread Group.
  • 32. 32 © Copyright GlobalLogic 2008 Module Controller contd.. Module to Run: The module controller provides a list of all controllers loaded into the gui. Select the one you want to substitute in at runtime.
  • 33. 33 © Copyright GlobalLogic 2008 As the other controllers are not made deactive so all controllers have been executed once. Under Module controller Simple Controller have been placed. Simple Controller have been executed twice.
  • 35. 35 © Copyright GlobalLogic 2008 Constant Timers: To pause each thread for the same amount of time Constant timer is used. Timer can be added as a child to thread group or as a child to sampler. If added to thread group it will delay the entire thread group for the time specified. And if it is added to sampler then it will delay the sampler by the given amount of time.
  • 36. 36 © Copyright GlobalLogic 2008 Uniform Random Timer: This timer pauses each thread request for a random amount of time, with each time interval having the same probability of occurring. The total delay is the sum of the random value and the offset value. Total Delay = Offset + Random Delay.
  • 37. 37 © Copyright GlobalLogic 2008 • Synchronizing Timer: The purpose of the SyncTimer is to block threads until X number of threads have been blocked, and then they are all released at once. A SyncTimer can thus create large instant loads at various points of the test plan.
  • 39. 39 © Copyright GlobalLogic 2008 Synchronization timer(contd): In the above slide Random timer is kept to ensure that all the threads are delayed by random amout of time. Each thread is delayed by 3 to 13 seconds. Synchronization timer is used to make sure that all the desired no. of threads hit simultaneously at a link. So that the response of the page can be retrieved. If any thread reaches to the page first it has to wait for the desired no of threads , so that they all can go simultaneously to the page.
  • 40. 40 © Copyright GlobalLogic 2008 Pre Processor
  • 41. 41 © Copyright GlobalLogic 2008 A Pre-Processor executes some action prior to a Sampler Request being made. If a Pre-Processor is attached to a Sampler element, then it will execute just prior to that sampler element running. A Pre-Processor is most often used to modify the settings of a Sample Request just before it runs, or to update variables that aren't extracted from response text. Some of the Pre Processors 1) HTML Link Parser 2) Counters 3) User Parameters
  • 42. 42 © Copyright GlobalLogic 2008 HTML Link Parser: This modifier parses HTML response from the server and extracts links and forms. A URL test sample that passes through this modifier will be examined to see if it "matches" any of the links or forms extracted from the immediately previous response. It would then replace the values in the URL test sample with appropriate values from the matching link or form
  • 44. 44 © Copyright GlobalLogic 2008 Post Processors
  • 45. 45 © Copyright GlobalLogic 2008 Post Processors: A Post-Processor executes some action after a Sampler Request has been made. If a Post-Processor is attached to a Sampler element, then it will execute just after that sampler element runs. A Post-Processor is most often used to process the response data, often to extract values from it 1) Regular expression extractor 2) XPath Extractor
  • 46. 46 © Copyright GlobalLogic 2008 Regular Expression Extractor
  • 47. 47 © Copyright GlobalLogic 2008 Regular Expression Extractor
  • 48. 48 © Copyright GlobalLogic 2008 Assertion
  • 49. 49 © Copyright GlobalLogic 2008 Assertion: Assertions allow the ability to assert facts about responses received from the server being tested. Using an assertion, you can essentially "test" your that your application is returning the results you expect it to. 1) Response assertion 2) Size assertion 3) Duration assertion
  • 50. 50 © Copyright GlobalLogic 2008 Response Assertion
  • 52. 52 © Copyright GlobalLogic 2008 Functions
  • 53. 53 © Copyright GlobalLogic 2008 Using the functions Helper dialog, from options
  • 54. 54 © Copyright GlobalLogic 2008 Thread Number function
  • 55. 55 © Copyright GlobalLogic 2008 Recording using Jmeter for http request • 1. start jmeter with jmeter.bat on windows and jmeter.sh on unix • 2. select “test plan” on the tree • 3. right click on the “test plan” and add a new thread group: add -> thread group • 4. select the thread group • 5. right click “add -> config element -> Http Request Defaults” • 6. Protocol – enter “HTTP” • 7. Server name – enter “jakarta.apache.org” • 8. Path – leave blank • 9. Port number – enter “80” • 10.select workbench • 11.right click on workbench and add the Http proxy: add -> non-test elements -> HttpProxy Server • 12.Port field - Enter “8080” • Now also set the Browser proxy settings as localhost and port 8080 then start the test from Jmeter
  • 57. 57 © Copyright GlobalLogic 2008 Browser proxy setting
  • 58. 58 © Copyright GlobalLogic 2008 Listeners
  • 59. 59 © Copyright GlobalLogic 2008 Aggregate Report
  • 60. 60 © Copyright GlobalLogic 2008 Parameters of Aggregate Report • Label - The label of the sample. If "Include group name in label?" is selected, then the name of the thread group is added as a prefix. This allows identical labels from different thread groups to be collated separately if required. • # Samples - The number of samples for the URL • Average - The average time of a set of results • Median - The median is the time in the middle of a set of results. 50% of the samples took no more than this time; the remainder took at least as long. • 90% Line - 90% of the samples took no more than this time. The remaining samples at least as long as this. (90 th percentile) • Min - The shortest time for the samples of the given URL • Max - The longest time for the samples of the given URL • Error % - Percent of requests with errors • Throughput - Throughput measured in requests per second/minute/hour • Kb/sec - The throughput measured in Kilobytes per second • Times are in milliseonds.
  • 61. 61 © Copyright GlobalLogic 2008 Recording from Badboy for Https request Recording https request from badboy
  • 62. 62 © Copyright GlobalLogic 2008 Badboy test plan after importing to jmeter
  • 63. 63 © Copyright GlobalLogic 2008 Remote Testing
  • 64. 64 © Copyright GlobalLogic 2008 Distributed Test • It is recommended that we should not run more than 200 threads from one machine, so in order to test for 600 or 1000 users we go for distributed testing • Master – the system running Jmeter GUI, which controls the test • Slave – the system running jmeter-server, which takes commands from the GUI and send requests to the target system(s) • Target – the webserver we plan to load or stress Test
  • 65. 65 © Copyright GlobalLogic 2008 Remote Testing concept • Before we go ahead with distributed testing, there are a couple of things to check. • 1. the firewalls on the systems are turned off. • 2. all the clients are on the same subnet. 172.16.50.121, 172.16.50.101…….. • 3. the server is in the same subnet, if 192.x.x.x or 10.x.x.x ip addresses are used. If the server doesn't use 192 or 10 ip address, there shouldn't be any problems. • 4. Make sure jmeter can access the server. • 5. Make sure you use the same version of Jmeter on all the systems. Mixing versions may not work correctly.
  • 66. 66 © Copyright GlobalLogic 2008 Remote testing steps • On the slave systems, go to jmeter/bin directory and execute jmeter-server.bat (jmeter- • server on unix). On windows, you should see a dos window appear with “jre[version] • binrmiregistry.exe”. If this doesn't happen, it means either the environment settings are • not right, or there are multiple JRE installed on the system. Note: [version] would be the • jre version installed on the system. • 1. Open jmeter-server.bat in a text editor • 2. go to line 44 and find “:setCP” • 3. edit “START rmiregistry” to the full path. Example: “START • C:j2sdk1.4.2jrebinrmiregistry” • 2. On master system acting as the console, open windows explorer and go to jmeter/bin • directory • 3. open jmeter.properties in notepad or wordpad • 4. edit the line “remote_hosts=127.0.0.1” • 5. add the IP address. For example, if I have jmeter server running on 192.168.0.10, 11, 12, • 13, and 14, the entry would like like this: • remote_hosts=192.168.0.10,192.168.0.11,192.168.0.12,192.168.0.13,192.168.0.14 • 6. Start jmeter. • 7. Open the test plan you want to use
  • 67. 67 © Copyright GlobalLogic 2008 Distributed Testing architecture
  • 68. 68 © Copyright GlobalLogic 2008 Remote testing
  • 69. 69 © Copyright GlobalLogic 2008 Remote testing Machine name is different under samplers