load testing
DESCRIPTION
Basic introduction to load testing using JmeterTRANSCRIPT
Load Testing
Load Testing- Key Goals???
• Can the application support expected number of concurrent users??
• At what load does the application break or stop responding??
• When does the performance start deteriorating??
Testers
Load Generation System Under Test
Analysis?
123.20
All of you, click the GO button again
Manual Load Testing
Web server Database server
Coordinator
Testers
Load Generation System Under Test
Do you have the testing resources?• Testing personnel• Client machines
How do you coordinate and synchronize users?
How do you collect and analyze results?
How do you achieve test repeatability?
Analysis?
123.20
All of you, click the GO button again
Manual Load Testing
Web server Database server
Coordinator
Load Generation System Under Test
Benefits of Automation
Web server Database server
Virtual user generator (Jmeter)
• Controller manages the virtual users• Analyze results with graphs and
reports
• Replaces testers with virtual users
Solves the resource limitations
• Runs many Virtual users on a few machines
Analysis
Controller
Starting with JMETER
• Installing Jmeter• Step by step method to test single web page in
Apache JMeter• Manually creating a test plan in Apache
JMeter• Simulating 10 users through Apache JMeter
test plan
Installing & Running JMeter
JMeter requires a fully compliant JVM 1.5 or higher installed in your machine
•Download Jmeter from http://jmeter.apache.org/download_jmeter.cgi•Unzip to a folder•Go to "bin" directory•Double-click jmeter.bat
Lets get our hands dirty!!!
Simulate UsersAdd > Thread Groups•Number of Threads (concurrent users) = 10•Ramp up Time (seconds till all users are active) = 5•Loop Count (how many repetitions) = 1
Simulate web requests
Add > Sampler > HTTP Request•Server Name or IP = www.google.co.in•Path = /
Analyze reportsAdd > Listener > Summary report
Now Let’s use the recording functionality of Jmeter!!!
JMETER
Select “Non-test Elements > HTTP Proxy Server” and click “Start” button.
Web Browser
In Web browser set manual proxy configuration to ‘localhost’ and port as ‘8080’ and start browsing. The request will now be recorded by jmeter
Let’s add Variables!
Create a CSV file with the data you want to use(save in the same folder as jmeter script file)
Add "Config Element > CSV Data Set Config“Add under the Thread Group that will use itSet Filename = filename.csv Set Variable names = username,password (e.g.)
Set variables in HTTP Request "Send Params"Name = username, Value = ${username} Name = password, Value = ${password}
Variables from a CSV file
JMeter Functions
Syntax : ${__functionName(properties)}
Example:${__Random(100,1000,)}
Use “Function Helper Dialog” in Jmeter “Options” menu to see all in-built functions Jmeter has.
Interpreting Reports
ThroughputRequests per second
90% LineValue below which 90% of request times fall
Standard DeviationA measure of variation from average
LatencyDelay between request and response
SampleA sample means one sampler call. One request to web page in our case.
Generating higher loads with multiple "slave" computers
Install JMeter on slave computersFind the IP addresses of the slave computers
Add IP addresses to master computer's JmeterOpen [jmeter]/bin/jmeter.properties in a text editorAdd IPs to remote_hosts=127.0.0.1,192.168.1.241
Start JMeter server on all computers
Windows: Double-click [jmeter]/bin/jmeter-server.bat
Choose "Run > Remote Start All“ in Master
Some real life scenarios!!!
Is it possible to get a profile of how the application performed as you increased the number of concurrent users? What I would expect to see is that the response times will increase slowly, and then exponentially and then plateau out – at that point we should start to see errors (time outs) increasing. This should give us a fairly accurate view of the saturation point of one of the resources – CPU, network, memory, IO, etc.
Solution:
Stepping thread group was used to slowly increase the no. of concurrent users.
‘Response Times vs Threads’ Listener was used to analyse response time as the no. of users increased.
‘ Perfmon’ tool in the application server was used to analyze the server resources while the load was being generated by jmeter.
Stepping thread group
‘Response Times vs Threads’ Listener
Perfmon - Server resource Monitoring tool
Also, interested to know what sort of data was used – eg searching over a database with 5 records will be vastly different to 5 million records. And, how do we randomise the searches such that we are actually doing queries in the database, rather than hashed results because of query optimisations on the SQL server.
Solution:
Jmeter was used to automate bulk data entry into the system
The search term parameter was randomized using an external CSV file where thousands of unique strings were used as search term.
What problems does Load testing uncover???
Memory Leaks-These are the bane of many a site, and are almost always due to one of three things: -sloppy programming practices -poorly written third-party components -older components in the operating system or software layers
Resource Locking - happens in databases, where records are "locked" against being modified so that reliable results can be returned.
Bottlenecks - area in system operation where the flow of data is constrained and causes everything else to slow down.
Transactional Problems- problems with detailed interchange of information between the site and its user, and often involves some-thing that is processed in several distributed steps on the backend.
Hardware Limitations - hardware you have just isn't enough to support the work you need to do.
Defining Testing Objectives• Common Objectives:
Measuring end-user response time Defining optimal hardware configuration Checking reliability Assist the development team in determining the performance characteristics
for various configuration options Ensure that the new production hardware is no slower than the previous
release Provide input data for scalability and capacity-planning efforts Determine if the application is ready for deployment to production Detect bottlenecks to be tuned
Load testing is an evaluation of system performance under normal conditions, all the way up to the maximum number of users supported by your configuration.
Stress testing is a determination of how the system behaves when pushed "over the edge", including how well it recovers from being pushed in this fashion.
What should be tested?High frequency transactions: The most frequently used transactions have the potential to impact the performance of all of the other transactions if they are not efficient.
Mission Critical transactions: The more important transactions that facilitate the core objectives of the system should be included, as failure under load of these transactions has, by definition, the greatest impact.
Read Transactions: At least one READ ONLY transaction should be included, so that performance of such transactions can be differentiated from other more complex transactions.
Update Transactions: At least one update transaction should be included so that performance of such transactions can be differentiated from other transactions.
“I hear and I forget. I see and I remember . I do and I understand”