Professional Documents
Culture Documents
Load Testing With JMeter
Load Testing With JMeter
User
User
User
User
App
3
User
User
User
User
User
User
User
User
User
User
User
User
User
User
User
User
User
App
4
User
User
User
User
User
User
User
User
User
User
User
User
User
User
User
User
User
App
5
Load Testing
Key goals
Can app support expected concurrent users? At what load does the app break?
Steps
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
Commercial Tools
LoadRunner (around $200,000 to own!) WebLoad Third-party $ervices
Feature-rich
Post forms Record from browser Load test data from les Add logic, variables & functions Run one test from multiple machines Test many protocols, not just HTTP
8
Analyze reports
Response times acceptable? Handles expected load? What load causes failure?
JMeter's Nomenclature
User!!!!!!!!!!!!!!!!!! Thread Request!!!!!!!!!!!! Sampler Report!!!!!!!!!!!!!!! Listener
13
Analyze reports
Add > Listener > Aggregate Graph Add > Listener > View Results Tree!
Request
Request sent to web server
17
Response Data
Server response body (HTML, etc.) View as text or rendered HTML, etc.!
19
Logic Controllers
Group Items
Simple
!Looping
Loop, ForEach*, While*
Logical*
If
20
Time Control
Throughput, Runtime!
Add an If Controller
Let"s modify the existing Test Plan Add Controller > If Controller under Thread Group Copy the 3 requests
1. Yahoo 2. Google 3. CNN
22
Use Grouping if recording multiple pages Add HTTP Request Defaults under Controller
Fill in domain Now matching recorded domains will be blank
25
Recording forms
JMeter records all submitted elds
Easier than examining source code or Firebug!
26
JMeter Variables
Dene global variables
Test Plan (root element) Cong Element > User Dened Variables
Reference as ${variableName}
Can be used in nearly any property Scope determined by location in hierarchy
28
29
Debugging
Add Debug Sampler
Set JMeter variables as "True", others "False"
Add View Results Tree Listener Run Click View Results Tree Click Debug Sampler in Results Tree
Click "Response data" tab to view variables Looped user vars will show with numbers
30
JMeter Functions
Referenced as ${__functionName(properties)}
Like variables, can use in JMeter properties
Helpful functions
${__javaScript(expression to evaluate)} ${__threadNum()} ${__Random(min, max, varname)} ${__regexFunction(regEx, template, match, ...)}
31
Reading Reports
Most times are reported in milliseconds Throughput
Requests per second
90% Line
Value below which 90% of request times fall
Standard Deviation
A measure of certainty / uncertainty Measures variation from average
33
Latency
Delay between request and response
Going further...
35
36
Limitations of JMeter
Can't run embedded Javascript, Flash, etc.
But ... use recording to capture those requests
37
Reference
http://jakarta.apache.org/jmeter
38