Anda di halaman 1dari 35

Envision , Evolve, Unleash

Performance Testing - LR

Venu Gopal Reddy.S


• Why Load Test Your Web Application ?

• Functional vs. Load Web Testing
• Web-Based, Multi-Tiered Architecture
• Manual Testing Is Problematic
• The LoadRunner Solution
• LoadRunner Expert Workflow
“The Big Picture”
• Plan Load Test
• Sample Task Distribution Diagram
• Transaction Profile

10/17/08 2
Contents Contd…

• User Profile
• How to Use the Information
• Create VuserScript
• Actions
• Think Times
• Parameterization
• Determine Which Fields to Parameterize
• Parameterization Decision-Maker
• Select the Data Access Method

10/17/08 3
Contents Contd…

• Data File Replacement Methods

• Run-Time Settings – Iterations
• Summary - Parameterization
• Transactions
• Automatic Transactions
• Summary
• Next session……….

10/17/08 4
Why Load Test Your Web Application?

• Why Load Test Your Web Application?

– The failure of a mission-critical web
application can be costly
• don’t just cross your fingers

– Deploy with confidence

• assure performance and functionality under real-
world conditions

10/17/08 5
Functional vs. Load Web Testing
Functional Do business
test Functionality processes function
properly after

Load Will 2,000 concurrent
test Stability hits crash the server?

Is response time
Performance acceptable according
to specifications?
Do business
Functionality processes function
under load properly under heavy
10/17/08 6
Web-Based, Multi-Tiered Architecture

10/17/08 7
Manual Testing Is Problematic

Do you have the testing resources?

• Testing personnel
All of you,
• Client machines
click the
GO button How do you synchronize users?
How do you collect and analyze results?
How do you achieve test repeatability?


Analysis? Web server Database



Load Generation System Under Test

10/17/08 8
The LoadRunner Solution

Overcomes resource limitations

• Replaces testers with “Virtual Users”
• Runs many Vusers on few machines
• Controller manages the Vusers
• Meaningful results with analysis tools
• Repeats tests with scripted actions

Vuser Web server Database

host server

Load Generation System Under Test

10/17/08 9
The LoadRunner Solution
Provides support for many protocols and APIs

10/17/08 10
The LoadRunner Solution

Creates the Vusers

Virtual User Generator deployed by the Controller

Generates load
LoadRunner Controller and collects test results

Compiles and displays

LoadRunner Analysis test results with
graphical and statistical tools

10/17/08 11
LoadRunner Expert Workflow
“The Big Picture”

Phase 1 Phase 2 Phase 3 Phase 4 Phase 5

Analyze Tune
Plan Load Create Web Create Run
System Under System Based
Test Virtual Users Scenarios Scenarios
Load on Analysis



10/17/08 12
Plan Load Test

• System Usage Information

– Task Distribution Diagram
• which business tasks?
• how many operations at what times of the day?
– Transaction Profile
• how many operations on average, how many at peaks?
• how much database activity?
• how much risk to business if task fails?
– User Profile
• which tasks does each real user perform?
• what is ratio of different tasks for each user?

10/17/08 13
Sample Task Distribution Diagram

Hours to be
Business emulated
Logout Night 40 30 Day40 75 Night

Compose 1000 1200 600

Inbox 180 210 150 130 100

Login 150 200 170 140

*Yahoo 50 50 50 50

*System backup 1 1

12 2 4 6 8 10 12 2 4 6 8 10 12
am pm

ONLINE BOOKSTORE (typical day, thousands of users)

*not a web task 10/17/08 14
Transaction Profile

Which business process to automate?

Business Typical day Peak day Web server activity Databas Risk
process name e activity

Log in 70/hr ✓ ✓
210/hr Heavy Light High ✓
10/hr 15/hr Moderate Moderate Low

Compose 130/hr ✓ ✓
180/hr Moderate Moderate Mod.

New Folder 20/hr 30/hr Moderate Moderate High ✓

Logout 40/hr 90/hr ✓ Moderate Heavy ✓ High ✓
✓ High throughput
criteria: ✓ High in database I/O
✓ High business risk (should business process fail)
10/17/08 15
User Profile

Folder 1 Folder 2 Folder 3
No. of Concur-
15 5 10
rent Users

InBox 10/hr 5/hr

Login 5/hr 25/hr

Logout 5/hr

Compose 5/hr

10/17/08 16
How to Use the Information

• Decide which business processes to automate

• Learn what processes are linked (data
• Discover peak load times
– peak hours of the day
– peak days of the month, quarter, or year
• Decide whether to emulate processes or users

10/17/08 17
Create VuserScript

•Record Vuser Actions

• Add Load Runner Transactions
•Parameterize data
• Verify correct Execution

10/17/08 18

• A recorded business process that, when

played back, emulates a real user
performing the business process actions on
a system.
User Actions Logoff
optional) (Business Processes) (recording

vuser_init.c Action1.c, Action2.c, etc.

(e.g., Create Order, Ship Order) vuser_end.c

This section may be iterated

(repeated) during one test run

Virtual User Playback Model

10/17/08 19
Think Times
Think time steps:
• Simulate human users by pausing between user actions

• Inserted automatically
by VuGen during
• Default Run-Time
Setting is “Ignore think
times” *(VuGen only)

10/17/08 20
• The practice of replacing a recorded value in a Vuser
with a placeholder which can represent an
expandable range of values.
• Solve certain problems that may occur during playback
– date constraints
– unique constraints
– data caching
– data dependency
• Emulate real user activity
• Exercise the server

10/17/08 21
Determine Which Fields to
• Which fields require a current date?
• Which fields require unique values?
• Which fields exercise the database
• Which fields’ values are dependent
for validity on the value of another

10/17/08 22
Parameterization Decision-Maker
For each field, ask . . .

Do not
Is there a
constraint? No
Is there a
constraint? No
Does No
data get
cached? No
Is this a
Yes data


Parameterize Parameterize Parameterize Parameterize

10/17/08 23
Select the Data Access Method

• Sequential
• Random
• Unique
• Same line as

10/17/08 24
Data File Replacement Methods

Sequential Random Unique

Vuser 1 Vuser 2 Vuser 3 Vuser 4
a a a e a i a m
1 a f l i
b b b f b j b n
2 c e m c param1

c c c g c k c o
3 d j k e
d d d h d l d p
4 h g n b
10/17/08 25
Run-Time Settings – Iterations
For the Sequential access method, Iteration
Count should equal the number of rows in the
data file

10/17/08 26
Summary - Parameterization

• Parameterize fields in order to:

– solve unique data constraints
– solve date constraints
– exercise the server(s)
– handle data dependency
• Establish input data:
– from the database
– with the help of a Functional Expert
• Control Vuser execution from the Run-Time Settings
– extended log, parameter substitution
– number of iterations

10/17/08 27

• An end-to-end (browser-to backend-to browser)

measurement of one or more user actions within an action
Why Add LoadRunner Transactions?
• Transactions are LoadRunner’s only means of
measuring performance
• Measure high business risk transactions
• Able to measure a single step or a group of steps
• Allows performance comparison between different
load tests
• Helps to identify performance problems

10/17/08 28
Transactions Cont….

• Start and End Transaction

• During recording Start and End Transaction

• After recording Start and End Transaction
• LR_AUTO – use this when you want LoadRunner to detect the
transaction status automatically
• LR_PASS / LR_FAIL – use one of these when you want to set the
transaction status manually in the code

10/17/08 29
Automatic Transactions

• Measure performance of every test step

• Compare individual steps to each other
• Compare individual steps to entire business process

12 sec
1 sec
9 sec Complete
12 sec
1 sec
21 sec
(1 minute,
19 sec 19 seconds
4 sec

10/17/08 30

• Use LoadRunner transactions to measure:

– end-to-end response times of specific steps in the
business process
– the entire business process
– every step in the business process automatically
• Add LoadRunner transactions during or after recording
• Use automatic LoadRunner transactions to measure
every step without manually inserting transactions

10/17/08 31
Next session……….

• Controller
• Analysis
• Advanced topics

10/17/08 32
Thank You

10/17/08 33
Goal Oriented Approach

Phase wise Approach

Goal definition (g)
Preparation (p)
Test execution (e)
Reporting + decision next phase (rd)
Multiple iterations of phase (p), (e) and (rd) are planned at a maximum of 3.
In general the more important a certain activity is the earlier it is scheduled
(i.e. cycle 1).
The overall project process can be depicted as follows:
g p1,2,3 e1,2,3 rd1,2,3 Same cycle

Goal Test prep. Test Test Finished!

definition execution reporting Decision

Next cycle

Max. 3 cycles

10/17/08 34

10/17/08 35