load runner 80
TRANSCRIPT
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 1/116
LoadRunner Quick Tutorial
LR78-SLIDES-01A
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 3/116
为什么要进行压力测试
The failure of a mission-critical application can be costly
Assure performance and functionality under real-world conditions
Locate potential problems before your customers do
Reduce development time
Reduce infrastructure costs
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 4/116
压力测试分类
Component Testing
Find the behavior and performance of each tier.
Load Testing Find out whether the system can handle the
expected load upon deployment under real-world
conditions.
Find the application's breaking point. Apply testing
that measures whether the application's
environment is properly configured to handle
expected or potentially unexpected high transaction
Stress Testing
volumes.
Volume Testing
Find the stability of the system with respect to
handling large amounts of data over extended
time periods.
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 5/116
压力测试目标举例
Application response time
How long does it take to complete a
task?
Configuration sizing
Which configuration provides the
best performance level?
Acceptance
Is the system stable enough to go
into production?
Regression
Does the new version of the software
adversely affect response time?
Reliability
How stable is the system under a
heavy work load?
Capacity planning
At what point does degradation in
performance occur?
Bottleneck identification
What is the cause of degradation in
performance?
Product evaluation
What is the best server for 100
users?
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 6/116
手工测试的问题
Testers
Do you have the testing resources?• Testing personnel• Client machines
How do you synchronize users?
How do you collect and analyze results?
How do you achieve test repeatability?
Everybody,click theSEARCH
button again
Coordinator
Applicationserver
Databaseserver
Load Generation System Under Test
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 7/116
LoadRunner解决方案
Overcomes resource limitations
• Provides meaningful results with
analysis tools
• Allows repeatable tests with scriptedactions
Analysis
• Runs many Vusers on few machines
• Replaces testers with "Virtual Users"
• Controller manages Virtual Users
Databaseserver
Controller
Vusers
VirtualUser loadgenerator
Applicationserver
Load Generation System Under Test
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 8/116
LoadRunner的实现方法
LoadRunner is a complete solution to conduct automated load
testing before, during, and after application deployment.
LoadRunner allows you to...
Scale
the application to
a predetermined
capacity.
Identify
business processes
or system
components havingtrouble.
Diagnose
a problem to
pinpoint the
root cause.
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 9/116
LoadRunner 组件
Vuser Script Recorder – records Vuser scripts thatsimulate the steps of real users using the application.
LRVUGEN
The Controller is an administrative center for
creating, maintaining and executing Scenarios. The
Controller assigns Vusers and load generators to
Scenarios, starts and stops load tests and performs
other administrative tasks.
LRCONTROLLER
LR Analysis provides graphs and reports. These graphs
and reports summarize the system performance.LRANALYSIS
This course focuses on LR Controller and LR Analysis. LR VuGen is discussedin a separate course.
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 10/116
LoadRunner 支持的环境
Platforms:NT, 2000,XPSunHP
IBMLinux
Web:HTTP(S)CORBAWAPCOM
RMILDAPWinsockStreamingFTP
IIOPPOP3iModeRealPlayerMS Media
Voice XMLSMTP
MiddlewareProtocols:CORBACOMEJBs
TUXEDOJoltJDBCMQSeries
ERP/CRM:Oracle Apps.SAPSiebelPeopleSoft
ClarifyBaan
Databases:OracleMS SQLServerDB2Sybase
InformixODBC
Legacy:32705250VT100
In ternet / In t ranet Webservers Appservers Databaseserver Cl ients
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 11/116
什么是 Scenario?
Scenario
A scenario is a file that defines which
Vusers to execute, the number of
Vusers to run, the goals of the test,
which computer hosts the Vusers and
the conditions under which to run the
load test.scripts
run-timesettings
loadgenerators
real-timemonitors
virtual users
Elements of a Scenario
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 12/116
LoadRunner的工作方式
Databaseserver
Appservers
Webservers
LRCONTROLLER
LOADGENERATOR 2
(NY)
LRANALYSIS
LOADGENERATOR 1(SF)
1.Create scenarios
and assign them to
load generators.
2.Generates load and
sends performance
data to controller.
3. Access the reports
and graphs.
2.Generates
load and sends
performance
data to
controller.
Performance metrics
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 13/116
硬件配置需求
Win NT
Win 2000Win XP
500 MB
Win NT
Win 2000Win XP
UNIX
Depends on
the number
of Vusers and
runtime
settings.
Win NT
Win 2000Win XP
200 MB
Operating System
Free Hard Disk
Space
256 MB256 MB256 MBMemory
AnalysisLoad
Generator
ControllerLR
Components
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 14/116
压力测试流程
TweakSystem Based
on Analysis
Plan Load
Test
Plan Load
Test
1
Create
Virtual Users
Create
Virtual Users
2
Scenario
Creation
Scenario
Creation
3
Scenario
Execution
Scenario
Execution
4
Results
Analysis
Results
Analysis
5
CreateScenarios
based onyour goals
Fine tunesystem
based onanalysisdata andre-run thescenario
DefineGoals
Analyzesystem
GatherSystem
UsageData
RecordScripts and
turn scriptsinto Vusers byadding testdata and userbehavior
ExecuteScenarios
for testingfirst,running100% andoverloading
Analyzeresults
data andpinpointbottlenecks
Rerunning the scenario indicates whetherperformance has improved and whether goals
have been achieved.
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 15/116
压力测试是一项团队工作
Manages the test applicationimplementation for all phases of
load testing
Provides expertise on the businessfunctionality of the applicationunder test for planning phase
Team Member Main Responsibility
Project Manager
Functional Expert
Creates the multi-user load onthe system for all phases of loadtesting
LoadRunner Expert
Analyzes and tunes the
application server for resultsanalysis phase
Application Server
Performance BasisExpert
Analyzes and tunes the databaseserver for results analysis phase
Database PerformanceBasis Expert
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 16/116
LoadRunner 团队工作
Tweak
System Basedon Analysis
Plan Load
Test
Plan Load
Test
1
Create
Virtual Users
Create
Virtual Users
2
Scenario
Creation
Scenario
Creation
3
Scenario
Execution
Scenario
Execution
4
Results
Analysis
Results
Analysis
5
LR Expert
FunctionalExpert
ProjectManager
LR Expert
FunctionalExpert
ProjectManager
LR Expert LR Expert
Sys Admin
ServerExpert(s)
Sys Admin
ServerExpert(s)
LR Expert
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 18/116
在创建脚本之前要进行充分的规划
Plan Load
Test
Plan Load
Test
1
Create
Virtual Users
Create
Virtual Users
2
Scenario
Creation
Scenario
Creation
3
Scenario
Execution
Scenario
Execution
4
Results
Analysis
Results
Analysis
5
Goals, business processes,
user type, user behaviors, input
data, system profiling,
scenario design, and LoadRunnerinstallation
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 19/116
规划阶段的内容
1. 建立负载测试的目标 制定出可以用数量衡量的目标标准
2. 分析被测系统的业务运行状况
确定要录制哪些商业流程(business processes)
确定业务高峰的负载情况和时间
把需要测试的BP的操作步骤形成正式文档
准备测试数据
3. 收集系统的技术信息
确定系统的架构 确定系统各部件的软件情况,使用什么样的数据库服务器?
Web服务器? 以帮助我们在合理的时间内确定系统瓶颈
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 20/116
本次培训使用的Demo软件
St ar t > Programs > Mercury Tours
Before you access the
training application:
Invoke the Apache
Server (Start >Programs > Start
Server)
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 22/116
录制Web脚本的方法
1.运行VuGen,创建新的脚本
2.选择创建Web(HTTP/HTML) protocol的脚本
3.设定录制选项 Recording Options.
4.开始录制
5.进行正常的业务流程的操作
6.当业务操作完毕后,按Stop Recording将录制结束
7.保存脚本
DEMO – 老师将会演示如何录制脚本
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 23/116
设定录制选项 Recording Options
Recording
Browser
Recording Proxy
Advanced
Correlation
DEMO – Recording Options
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 24/116
两种不同查看脚本的方式
Script ViewTree View
Each Tree View icon
represents a ‘C’ statementviewable in Script View
Tree view has icons for the
recorded user steps
DEMO – Tree and Script View
– Icon and usage examples
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 25/116
什么时候选择不同的录制方式?
HTML
Recording:This is default mode.
If problem encountered with form submission or
with link clicking then record with URL optionchecked under HTML Advanced
Records a separate request for each objectrequested from the server. Gives best control
over traffic.
URLRecording:
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 26/116
脚本的目录结构
C:\ C:\
web_projectweb_project-
ScriptsScripts-
-
Action1.cAction1.c
vuser_init.cvuser_init.c
vuser_end.cvuser_end.c
Lab1Script2.usrLab1Script2.usr
As soon as the script is
saved, these are the
folders that you will see
Lab1Script2Lab1Script2
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 27/116
设置回放的运行时刻设置Run-time Settings
Run Logic
Pacing
Log
Think Time
Miscellaneous
Speed Simulation
Browser Emulation
Proxy
Preferences
ContentCheck
Available for
all protocols.
Specific to
Web.
DEMO – Run-time Settings
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 28/116
运行脚本
Click the Run
button to play
back the script.
The Execution loglists all messages
once the script has
stopped running.
DEMO – Running a script and how to set results directory
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 29/116
常用的调试脚本的工具
Test Results window
Execution Log
Snapshot Results window
Page View
Server Response
Client Request
Run-Time Viewer
DEMO – Available debugging tool options
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 30/116
本节总结
本节介绍了常用的录制选项
本节介绍了两种录制Web协议脚本的方法
本节介绍了运行时刻的各种设定
本节介绍了一般选项的设定
本节介绍了进行调试脚本的基本工具
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 31/116
什么是Action?
Action
A set of recorded user actions in a
Vuser that allows you to emulate a
particular user task through script
iteration.
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 32/116
在Web脚本里面使用多个Action
A Web Vuser (script):
Search for a CD Order the CD
Log in
Go to checkout
vuser_init
Run once
Action
Run 3 times
vuser_end
Run once
Search for a DVD Order the DVD Action1Run 5 times
Search for a book Order the book Action2Run 4 times
then
then
then
then
Action
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 33/116
使用多个 Action的典型例子
最典型的情况是用户登录一次,进行多次业务,然后退出系统:
Record Login user steps in ‘vuser_init’
Record selecting an item in the first section called ‘Action’
Record placing items in shopping cart user steps in ‘Action1’
Record Checkout and Logout user steps in ‘vuser_end’
Internet
DBserver
Webserver
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 34/116
如何把不同的操作录制到多个 Actions中?
Action list
1. Start recording
2. Select action file
3. Record users steps in
the appropriate
action file
4. Repeat steps 2 and 3as necessary
5. Stop recording
DEMO – Adding creating LR Actions
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 35/116
注意设定好开始和结束的状态
Always end at this page
if the next iteration is
Sign-On or Register.
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 36/116
根据测试目标来确定脚本的Action
Emulate three types of users where 50% of the users are logging
in, 25% are searching and the remaining 25% are booking tickets?
Load Testing Goal:
Suggested method:Record one script with all three business processes under
separate actions and apply weighting.
DEMO – Creating Weighting
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 37/116
如何衡量操作的响应时间?
Start ApplicationSTEP 1
How can I isolate
a measurement of
just the Sign-in
response time?
Type username and passwordSTEP 2
Click on Sign-In buttonSTEP 3
Wait for confirmationSTEP 4
Select a departure and
arrival citiesSTEP 5
Enter datesSTEP 6
STEP 7 Enter credit card details
Click on SubmitSTEP 8
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 38/116
什么是Transaction?
LoadRunner TransactionGives an end-to-end measurement of time
elapsed in the execution of one or more steps
in a business process.
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 39/116
LoadRunner的Transactions测量什么内容?
Request
(Transaction starts)
Sign-In
transaction
took 8 secResponse
(Transaction ends)
Web
ServerUser
LoadRunner transactions measure the transmission
and response time between client and server.
Transaction
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 40/116
Transaction开始和结束按钮
Common icons and
usage examples
Start Transaction Set starting point for
measurement
End Transaction Set end point for
measurement
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 41/116
Transaction的状态
LR_AUTO – (default) - use this to detect the transaction status
automatically
LR_PASS / LR_FAIL / LR_STOP – use these when you
want to set the transaction status manually in the
code
Transactions
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 42/116
Transactions中的思考时间如何处理?
Think times May reduce accuracy of
transaction measurements
Can be filtered out of Analysis
graphs
通过检查运行日志来确定
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 43/116
Transaction的执行结果
Transactions
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 45/116
参数化的概念
Recorded Script
Select San Francisco
Selection is hard coded and willselect San Francisco on every run
Parameterized Script
Select <dep_city>
Selection is parameterized and willselect different city on every run
“ ”?
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 46/116
为什么要引入“参数化”?
REAL USERS
Varied input to
the application
Static input to
the application
Recorded
script
(Virtual Users)
To Emulate real-world behavior and to create realistic results
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 47/116
什么时候需要参数化?
Start ApplicationSTEP 1
Type username and passwordSTEP 2
Datadependency
STEP 3 Click on Sign-In button
STEP 4
Unique
constraint Wait for confirmation
Select a departure and
arrival citiesSTEP 5
Data
cachingEnter datesSTEP 6
STEP 7 Enter credit card details
STEP 8
Date
constraint
Click on Submit
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 48/116
如何参数化输入数据
1.Determine which fields to parameterize.
2.Replace recorded values with parameters.
3.Decide which parameter type to use.
4.Create the data file.
5.Populate the data file.
6.Choose the data access method and the number of
iterations.7.Run the Vuser and analyze the results to verify correct
execution.
DEMO – How to parameterize a input data
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 49/116
参数的类型
Specifying the source for the parameter data.
There are three types:
Internal Data
Data Files
Master Data
User Generated Data
External Data
User-Defined Functions
‘File’类型参数的数据访问方式
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 50/116
• Sequential
• Random
• Unique• Same line as
<parameter>
Select next tells LoadRunner in what order to use data
from the file (data source)
如何查看脚本执行时参数的值?
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 51/116
To see parameter data in the Execution Log, select Ext ended log and Paramet er subst i t ut ion in the Run-time Settings
数据个数和Run Logic的关系
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 52/116
To test all data using the Sequential access method,
Number of Iterations should equal the number of rows in the data file
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 53/116
什么是检查点Checkpoint?
CheckpointA checkpoint is a step in a Vuser script
which verifies whether a visual cue
appeared as expected.
Verification always results in a PASS or FAIL status
在大并发用户压力的情况下验证脚本是否执
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 54/116
行成功是负载测试的基本要求
Success. Business
process complete.Low load
One Vuser running
the script
Failure. Business
process failed.Increase in load
Script run under load withmany concurrent Vusers
确定脚本执行成功的标准
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 55/116
What indicates theticket was purchased
successfully?
Login
Select departureand arrival cities
Select departureand arrival dates
Select flight
Purchase ticket
ContinueShopping
There was an errorwhile generating your
order!
Your itinerary wasbooked! Thank you forchoosing MercuryTours.
通过界面的某些信息来确定脚本是否执行成功
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 56/116
Flight confirmation
image and text appearafter pressing the
Secure Purchase button.
Image Confirmation
Text Confirmation
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 57/116
检查点的基本内容
(1) Capture the information needed to performverification.
(2) On playback, compare the actual value on theapplication to the saved expected value.
(3) Send the comparison result (the "status") as either
PASS – Test requirement # 5 successful.OR
FAIL – Test requirement # 5 failed.
ExpectedValue
ActualValue
PASSIF
LoadRunner
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 58/116
LoadRunner提供的文本检查点
VuGen allows you to add Checkpoints for verification
automatically and also programmatically.
Checkpoint Icons
Text A text check is a search for a
specified text string on a Web page.
Adds web_reg_find function tothe script.
关联的基本概念介绍 – Recording
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 59/116
VuGen Script
Login
(User Name jojo Password bean )
1.Log in
User Name jojo
Password bean
2.Your sessionid@@@12345
3.Request for product
info
4.Product info found
Response
(SessionID@@@12345 )
Request for product info
(SessionID@@@12345 )
Web
Server
Response
Product info
Dynamic data is hard-coded in the script
关联的基本概念介绍 - Playing Back
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 60/116
VuGen Script
Login
(User Name jojo
Password bean )
1.Login
User Name jojo
Password bean
2.Your sessionid@@@12345
3.Request for productinfo
4.Product info found
Response
(SessionID@@@23456 )
Web
ServerRequest for product info
(SessionID@@@12345 )
Response
ERROR SessionID 12345 has expired
Login again to get product info
Reusing recorded dynamic data will cause errors when you replay the script
关联的基本概念介绍 - Solution
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 61/116
Web
Server
Login
(User Name jojo
Password bean )
Response
(SessionID@@@23456 )
Request for product info
(<SessionID@@@23456>)
Response
Here is the requested product info
Correlat ed VuGen Script
1. ……
2.Your <session_id>
3. ……
4. ………
Recorded dynamic data must be correlated using parameters
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 62/116
关联是一个原理性的问题
关联是一个原理性的问题,在任何协议的脚本中都存在1
2
关联是开发脚本的最耗时,最烦琐的一个过程.因为每个被测系统都不同
3为了减轻关联的工作量,LoadRunner提供了一些自动化关联的辅助工具
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 63/116
手工关联的基本步骤
1. Play back the script and determine if error is due tocorrelation.
2. Determine which dynamic values to correlate.
3. Find the left boundary, right boundary and occurrence of thedynamic value.
4. Add a web_reg_save_param function and the arguments tothe script, above the step which requests the page with thevalue to capture.
5. Parameterize the dynamic value in the script every time itoccurs.
6. Verify correct execution.
关联的第一步:脚本回放失败
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 64/116
Q: Why did the step creation fail?
1. Make a note of which step failed.
2. Investigate the Execution Log.
通过WDiff 查看脚本变化的内容
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 65/116
There are five differences highlighted.
确定哪些动态信息需要关联• These values represent the screen locations of mouse clicks
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 66/116
ese a ues ep ese t t e sc ee ocat o s o ouse c c s
• They are used by the script but do not need to be correlated
"Name=buyFlights.x", "Value=52", ENDITEM, "Name=buyFlights.x", "Value=23", ENDITEM,
"Name=buyFlights.y", "Value=15", ENDITEM, "Name=buyFlights.y", "Value=17", ENDITEM,
lr_think_time( 2 ); lr_think_time( 1 );
lr_think_time( 7 ); lr_think_time( 11 );
"Name=flight_210", "Value=on", ENDITEM, "Name=flight_206", "Value=on", ENDITEM,
"Name=removeSelected.x", "Value=101", ENDITEM, "Name=removeSelected.x", "Value=80", ENDITEM,
"Name=removeSelected.y", "Value=13", ENDITEM, "Name=removeSelected.y", "Value=10", ENDITEM,
lr_think_time( 1 );
1
2
3
4
5
Think times are used by the scriptbut do not need to be correlated
Flight number is dynamic and
requires correlation
关联的函数: web_reg_save_param
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 67/116
web_reg_save_param has the following arguments:
User-defined parameter name Indicates "no more attributes"
("param_name", <List of Attributes>*, LAST);
"LB=", "RB=", "ORD=",
Optional indicatesordinal or instance orthe match
The left & right boundaryof the parameter or thedynamic data
*See the LoadRunner documentation for a complete list of attributes
在Server Response中确定动态信息的左右边界
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 68/116
LEFT BOUNDARY
RIGHT BOUNDARY
6
LB: type="checkbox" name=" RB:"
脚本录制完成后自动关联的方法
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 69/116
需要将脚本回放一次
LoadRunner会自动比较回放时的结果和录制时的结果,确定需
要关联的内容
回放完成后可以使用LoadRunner内置的Scan f or Correlat ions
工具进行自动关联
脚本录制时自动关联的步骤
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 70/116
1. Enable Correlation during recording in Recording Options2. Create new application
3. Create new rule for the newly created application anddefine properties for the new rule
4. Test the newly created rule (optional)
5. Record the script
6. Play back the script to verify correct execution
DEMO – Correlation During Recording
第四节
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 72/116
Understanding Scenarios
Scheduling Scenarios
Runtime Settings
Performance Monitors
Tweak
System Basedon Analysis
Plan Load
Test
Plan Load
Test
1
Create
Virtual Users
Create
Virtual Users
2
Scenario
Creation
Scenario
Creation
3
Scenario
Execution
Scenario
Execution
4
Results
Analysis
Results
Analysis
5
什么是 Scenario?
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 73/116
Scenario
A scenario is a file that defines which
Vusers to execute, the number of
Vusers to run, the goals of the test,
which computer hosts the Vusers and
the conditions under which to run the
load test.scripts
run-timesettings
loadgenerators
real-timemonitors
virtual users
Elements of a Scenario
LoadRunner Controller
Before scenario execution
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 74/116
Before scenario execution
used to design scenario
used to initiate scenario run
During scenario execution runs many Vusers simultaneously
controls each Vuser (initialize, run,
pause, stop)
displays execution status of each Vuser displays messages from each Vuser
monitors system and network resources
After scenario execution collects and organizes performance data
launches the Analysis tools
Controller
organizes
and manages
scenario
elements
DEMO – Controller
选择 Scenario 类型
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 75/116
Choose one of
these types when you start a
new scenario:
Manual
Goal-Oriented
DEMO – Scenario Types
Manual 与 Goal-Oriented Scenarios 比较
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 76/116
Manual Scenario
main purpose is to learn how many Vusers can
run concurrently gives you manual control over how many Vusers
run and at what times
Goal-Oriented Scenario
goal may be throughput, response time or
number of concurrent Vusers
LoadRunner manages Vusers automatically
选择哪一种 Scenarios 类型?
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 77/116
Scenario Outline Scenario Type
1.Script should define ‘Update’
2.When running the load test at peakload, achieve 1,000 concurrent users
Manual scenario with
1,000 concurrentVusers
1. Script should define ‘Search’
Transaction
2. When running the load test during non-
peak hours achieve response time of 8
secs. with 2,000 concurrent users
3. When running the load test in peak hours
achieve response time of 12 secs with
5,000 concurrent users
Goal-Oriented scenario
with Transaction Response Time as the
‘Goal Type’
Scheduling Scenarios
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 78/116
Allows repetition of important usage patterns throughout
load testing for defined duration of load test.
DEMO – How to access Schedule Builder
Schedule by Scenario
Applies same schedule across all groups
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 79/116
Allows delay in start time for scenario
Creates a profile of usage by “users”
Schedule by Group
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 80/116
Individual settings for each group
Allows delay in start time for scenario
Creates a profile of usage by “business process”
Ramp Up 与 Ramp Down
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 81/116
Ramp Up Allows loading all Vusers in the scenario gradually
Timed increments pinpoint the exact point at which
a system/software fails or degrades
Ramp Down
Only applicable for scenarios where in theDuration tab Run for option is selected
Specify how many Vusers to stop and how often
Stop all Vusers at once
Primarily used to detect memory leak and system
recovery after heavy load
什么是 Run-time Setting
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 82/116
Run-time Settings can be configured in VuGen and in
the Controller
Different Groups of Vusers many have different Run-timeSettings
Run-time Settings greatly affect Vuser behavior
Run-time Settings greatly affect Vuser “footprints”
Run-time Settings
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 83/116
Run Logic
Pacing
Log
Think-Time
Miscellaneous
DEMO – How to access Run-time Settings
Run Logic 与 Pacing
Used to model more closely the way real users interact
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 84/116
y y
with the application
Run Logic
Replicates a real user performing steps in a business processmore than once
Allows setting of the iteration count (how many times a Vuser
will repeat a task)
Pacing
Controls the delay between iterations
Can be used to extend the amount of time a test runs
Log 设置
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 85/116
In Controller, logging is enabled by default to send messages
only when there is an error
Used for Vuser information such as
error messages
parameter substitution
transaction status verification status
Think Time
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 86/116
Think Time introduces the right amount of delay to
emulate user behavior accurately
Allows replaying or ignoring of recorded Think Time(default = replay)
Influences how the Vuser uses the recorded Think Time
Ignoring Think Time will greatly affect the scalability of the
load generators
Miscellaneous Settings
Error Handling
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 87/116
Continue on Error allows Vusers to attempt to proceed past an error.
It is used when Error Handling has been added to the script manually.
By default, Continue on Error is off.
Multithreading
Threading supports more Vusers per load generator
Process supports Vuser than can not be multithreaded
Automatic Transactions
Actions can be automatically “timed” as a Transaction. Script Actions
should be assigned meaningful names for clarity if automatic
transactions are used.
Step can also be automatically “timed” as a Transaction. Script steps
should be assigned meaningful names for clarity if automatic
transactions are used.
Scenario Run-time Settings
Scenario Run-time Settings relate to:
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 88/116
Vuser QuotasAllows setting the number of Vusers to initialize at one time.
Applies to all load generators. This setting can apply to
individual load generators.
Stopping VusersAllows setting how LoadRunner will stop the running of Vusers.
Random Sequence SeedEach seed value represents one sequence of random values
used for test execution. This setting applies parameterized
Vuser scripts and randomized think times.
DEMO – How to access Scenario Run-time Settings
Transactions 不能说明一切
Transactions measure the time required for a business
Th f f t ti t
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 89/116
process. The performance of transactions suggests apicture of the system component’s behavior.
Transaction: search
Exercises the Web, applicationand database server
This transaction performed
poorly with a response time of 30 seconds.
Transaction: buyExercises the Web and
application server
This transaction performed
as expected with a response
time of 1 min.
Performance Monitors
Apart from Transactions performance, you need Performance monitors
to highlight system component bottlenecks
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 90/116
to highlight system component bottlenecks
In ternet / In t ranetDatabaseserver
Appservers
WebserversCl ients
LoadRunner offers wide range of performance monitors for isolatingbottlenecks
Monitors are non-intrusive and agent-less Monitors gather data for online/offline analysis
Monitors display real-time data during testing
Monitors gather data for offline root cause analysis after testing
Performance Monitors
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 91/116
View and collect statistics during Scenario execution
using LoadRunner Controller online graphs
Correlate the collected statistical data in LoadRunnerAnalysis after scenario execution for root cause analysis
Facilitate collaboration between project members
during and after Scenario execution by allowing users toview multiple performance monitors via the browser
DEMO – Run Scenario with BookFlight script and how
online monitors give the current statistics.
- How to add and delete monitors.
配置 Monitor
To add measurement for
System Resource monitor
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 92/116
System Resource monitor.Do this:
1. Right-click a monitor pane
2. Select "Add Measure-
ment(s)" from pop-up
menu
3. Select server machine
name and resources to
monitor from the dialog
Administrative privileges are required to configure monitors
DEMO – How to configure monitors.
Monitor Measurements
Many system level
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 93/116
Many system-level
resources can be
measured. By
default, LoadRunner
selects many of the
important
measurements.
Consult with subjectmatter experts to
determine what
else should be
monitored.Measurements
added for Windows
Resources monitor
第五节
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 94/116
Scenario Execution
执行 Scenario 之前的准备工作
Add performance monitors in Run tab
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 95/116
Add performance monitors in Run tab.
Specify a location to save the scenario results and decide on a
name for the results.
Establish rendezvous policies, if any.
Executing Scenario 过程中的团队合作
Load test engineer monitors
transaction performance
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 96/116
Database
server
App
servers
Web
servers
transaction performanceAnd server monitors via
LoadRunner Controller
Network Administratormonitors network
performance while
load test is running
Application or DatabaseAdministrator monitors
remote system
performance
during load test
Scenario Execution 过程: Debug Run
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 97/116
DEBUG RUN
3-5 Vusers
ISOLATE
TOP TIME
TRANSACTIONS
20% LOAD
SCALABILITY
100% ++
LOAD
FULL LOAD
100%
Objective: Verify that parameterized data works under concurrent usage
Run-time Settings: Use extended log and data returned by server and
ignore think times
What to look for: No errors. This signifies that you are now ready toproceed with the load test
Scenario Execution过程: Isolate Top TimeTransactions
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 98/116
SCALABILITY
100% ++
LOAD
FULL LOAD
100%
DEBUG RUN
3-5 Vusers
ISOLATE
TOP TIME
TRANSACTIONS
20% LOAD
Objective: Isolate transactions that have performance problems
irrespective of load to find if there are any bottlenecks
Run-time Settings: Use standard log and ignore think time
What to look for: The worst performing transactions. This might be inabsolute time (longest) or it might be against
some measurable goal (2X as slow as the test objective)
Scenario Execution 过程: Full Load
SO
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 99/116
SCALABILITY
100% ++
LOAD
DEBUG RUN
3-5 Vusers
ISOLATE
TOP TIME
TRANSACTIONS
20% LOAD
FULL LOAD
100%
Objective: Verify that the system performs as expected under load
Run-time Settings: Turn logging off and enable think time
What to look for: Compare your load test goals to the test results
Scenario Execution过程: Scalability Test
ISOLATE
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 100/116
DEBUG RUN
3-5 Vusers
ISOLATE
TOP TIME
TRANSACTIONS
20% LOAD
FULL LOAD
100%
SCALABILITY
100% ++
LOAD
Objective: Verifies the load limit that can be handled before more
resources are required
Run-time Settings: Turn logging off and enable think time
What to look for: Load test goal should be exceeded, and 2X responsetime of your full load test (100%) should be achieved
Vuser 状态
Initialize and Run buttons affect selected Vusers.
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 101/116
Initialize and Run buttons affect selected Vusers.
Start Scenario runs all Vusers.
Vusers button opens Vusers window and shows status
of Vusers.
Vuser Window 与 Vuser Log
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 102/116
Scenario 状态
The Scenario Status window allows you to view:N b f V tl i
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 103/116
The Scenario Status window allows you to view: Number of Vusers currently running
Elapsed time
Hits/Second Passed/Failed transactions
Error count
Performance Monitor 状态
Start by looking at system resources – CPU
consumption and memory usage of servers.
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 104/116
p y g Then start observing application resources – are
there any 404 or 500 errors?
Use the above information in combination withresponse time and number of Vusers.
第六节
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 105/116
Result Analysis
哪里出现了问题 ?
Any link in the chain between browser and
database could be the cause of an applicationf il f d d ti
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 106/116
failure or performance degradation.
Appservers
Database
servers
Webserver
Web server slowdown
DB server slowdown
Network slowdown
Web
Client
Root Cause Analysis
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 107/116
Component metrics
System-level performance
Network and Server Response Times
End-user experienceTransaction Response Times
Performing root
cause analysis
means drillingdown from the
most general
reports to localized
metrics.
达到测试目标了吗 ?
The Summary Report provides a high-level view of the results of our
test
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 108/116
Max response
times
11 transactionsfailed
Average Transaction Response Time
Details transactionresponse throughout
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 109/116
response throughout
the test
Identifies
problematic
transactions
Identifies
problematicpoints in the test
Average Transaction Response Time
Under Load
Details transactionresponse time as a
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 110/116
response time as a
function of load
Identifies under what
load conditions
transaction times
begin to degrade
Transaction Response Time Percentile
Details transactionresponse time as a
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 111/116
response time as a
service level
Identifies
percentage of
transactions
complete over
time
Transaction Response Time Distribution
Detailstransaction
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 112/116
response time as
a distribution
count
Identifies number
of transactions
complete over
time
数据分析
The amount of data that can be gathered during a test is
staggering. Without some effective techniques for
i l i hi d di i i ld b
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 113/116
manipulating this data, diagnosing issues would be
impossible. LR Analysis provides:
Filtering to hide unwanted data from analysis
Regrouping to assemble data as desired by merging graphs,
tiling and auto-correlation
Duplicate graphing to separate data
Legend Filtering to update graph displays quickly
Drill-Down
DEMO – Filtering, Legend Filtering and Drill Down.
使用 Auto Correlation 查找性能瓶颈
Auto Correlation
Allows automatic selection of graphs to correlate in
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 114/116
order find the metrics that most influence thetransaction response time
Automatically correlates the transaction graph withALL performance metrics and displays the ones thatshow the highest match in their behavior; this allowsyou to disregard irrelevant metrics
Visually displays correlated metrics closelycorrelated to the transaction response time, whichspeeds identification of the likely causes of
performance bottlenecks
DEMO – Auto Correlation.
Analysis Reports
HTML FormatEase of sharing analysis results with other remote team
8/8/2019 Load Runner 80
http://slidepdf.com/reader/full/load-runner-80 115/116
members
Word FormatCan add comments and format the analysis data based
on your needs