性能测试工具LoadRunner实验报告.docx
《性能测试工具LoadRunner实验报告.docx》由会员分享,可在线阅读,更多相关《性能测试工具LoadRunner实验报告.docx(23页珍藏版)》请在冰点文库上搜索。
性能测试工具LoadRunner实验报告
性能测试工具LoadRunner实验报告
一、概要介绍
1.1软件性能介绍
1.1.1软件性能的理解
性能是一种指标,表明软件系统或构件对于其及时性要求的符合程度;同时也是产品的特性,可以用时间来进行度量。
表现为:
对用户操作的响应时间;系统可扩展性;并发能力;持续稳定运行等。
1.1.2软件性能的主要技术指标响应时间:
响应时间=呈现时间+系统响应时间吞吐量:
单位时间内系统处理的客户请求数量。
(请求数/秒,页面数/秒,访问人数/秒)并发用户数:
业务并发用户数;
[注意]系统用户数:
系统的用户总数;同时在线用户人数:
使用系统过程中同时在线人数达到的最高峰值。
1.2LoadRunner介绍
LoadRunner是MercuryInteractive的一款性能测试工具,也是目前应用最为广泛
的性能测试工具之一。
该工具通过模拟上千万用户实施并发负载,实时性能监控的系统行为和性能方式来确认和查找问题。
1.2.1LoadRunner工具组成
虚拟用户脚本生成器:
捕获最终用户业务流程和创建自动性能测试脚本,即我们在以后说的产生测试脚本;
压力产生器:
通过运行虚拟用户产生实际的负载;用户代理:
协调不同负载机上虚拟用户,产生步调一致的虚拟用户;压力调度:
根据用户对场景的设置,设置不同脚本的虚拟用户数量;监视系统:
监控主要的性能计数器;压力结果分析工具:
本身不能代替分析人员,但是可以辅助测试结果的分析。
1.2.2LoadRunner工具原理
代理(Proxy)是客户端和服务器端之间的中介人,LoadRunner就是通过代理方式截获客户端和服务器之间交互的数据流。
1)虚拟用户脚本生成器通过代理方式接收客户端发送的数据包,记录并将其转发给服务器端;接收到从服务器端返回的数据流,记录并返回给客户端。
这样服务器端和客户端都以为在一个真实运行环境中,虚拟脚本生成器能通过这种方式截获数据流;虚拟用户脚本生成器在截获数据流后对其进行了协议层上的处理,最终用脚本函数将数据流交互过程体现为我们容易看懂的脚本语句。
2)压力生成器则是根据脚本内容,产生实际的负载,扮演产生负载的角色。
3)用户代理是运行在负载机上的进程,该进程与产生负载压力的进程或是线程协作,接受调度系统的命令,调度产生负载压力的进程或线程。
4)压力调度是根据用户的场景要求,设置各种不同脚本的虚拟用户数量,设置同步点
等。
5)监控系统则可以对数据库、应用服务器、服务器的主要性能计数器进行监控。
6)压力结果分析工具是辅助测试结果分析。
二、LoadRunner测试过程
2.1计划测试定义性能测试要求,例如并发用户的数量、典型业务流程和所需响应时间等。
2.2创建Vuser脚本将最终用户活动捕获(录制、编写)到脚本中,并对脚本进行修改,调试等。
协议类型:
取决于服务器端和客户端之间的通信协议;脚本类型:
init(初始部分),Action(事务部分),end(退出结束);脚本录制:
捕获应用程序所执行的操作;验证回放:
检查是否准确模拟了录制的会话;事务:
表示要度量的最终用户业务流程;参数化:
将录制的一些常来替换为参数;
内容检查:
LR只检测到网页的响应,就认为是pass而不管当前网页的正确性,所以设置检查点,确保在测试时结果的正确性;
迭代次数:
action部分的循环次数。
2.3创建场景
对Vuser脚本进行场景设置和负载环境设置。
场景类型
手动场景:
通过定义Vuser组,Vuser脚本和运行脚本的负载生成器来创建场景;百分比模式:
定义场景中要使用的Vuser总数,负载生成器计算机以及要分配给每个Vuser脚本的Vuser占总数的百分比。
面向目标的场景;定义你希望的测试目标,LR会根据这些目标自动构建场景。
编辑计划:
设置加压方式、压力持续时间和减压方式等。
场景组:
选择组/脚本,虚拟用户数量以及负载生成器等。
运行时设置:
对脚本进行运行时属性设置。
三、实验过程
1)安装完成进入Loadrunner主界面
lx
LoadTesting
(3)点击Vuser下的StartRecording,出现如下界面:
StartRecording
输入URL地址,开始录制脚本。
Vuserinit是录制脚本的起始点;
Action是录制脚本的活动;Suserend是录制脚本的终止点;
(4)脚本录制完之,点击Tools工具栏下的CreateControllerSeenario…选项,会出现脚本
的运行次数,确定后会出现如下界面:
此界面是规划脚本的开始数目,开始时间,驻留时间,退出时间,同时退出的数目等。
点击Editscheduler按钮出现如下所示界面;
ScheduleBuilder
ScheduleNsme
DefdullSchedule
New..I)BenameIDelete
□KICane日也b|
ScheduleDefiriicin
RampVp|DurationEimpDown
LoadSellings
'LoadallVusassirmtafieously
(*Start)5Vusersevery|0000:
15
~InitializealVunrsbeforeRun.
(seledihgIbisoptionmeansthalrunningbeginsonlyafleralVuser^reachtheReadystate]
1.RampUP
上图所示为每15秒运行5个脚本;
2.Duration
计划每个脚本的驻留时间;
3.RampDown
规定每隔多长时间退出多少数目;点击OK,出现下图界面;
(5)开始压力负载测试:
图示数据只为说明,并不是实验真实数据
r
MercuryLoadRuiuierController-Scenario!
1-[Run]
□
0
I
FileMcnitprsRevolt'sRi^howtitsTqc|.sHtlp
MM
®ilb
衲菇rf
図DesignSRun
'
AulaColltiaR«eu
四、实验结果:
ExecutiveSummary
ObjectivesAddtexthere
SeenarioSummary
10minutesand20seconds.
50
TotalDuration(ineludingRampUp/Down):
MaximumRunningVusers:
TotalThroughput(bytes):
TotalHits:
TopTime-ConsumingTransactions
TransactionNameAve90%
vuser_init_Transaction
0.189
0.675
vuser_end_Transaction
0.013
0.013
ActionTransaction
0.001
0
Conclusions
Addtexthere
SeenarioConfiguration
Files
ResultsinSession:
C:
\DocumentsandSettings\Administrator'LocalSettings\Temp\noname3\res\res.lrr
SessionName:
Session1.lra
Name:
Seenariol
SchedulerInformation
Duration:
LoadBehavior:
Runfor000:
05:
00(hhh:
mm:
ss)
Start5Vusersevery00:
00:
15(hh:
mm:
ss)
EndedOn:
30-11-200814:
55:
29
Scripts
ScriptTypeFile
noname3
QTWeb
C:
\DocumentsandSettings\Administrator'Local
Settings\Temp\noname3\noname3.usr
RunTimeSettings
QTWeb
GroupScriptPacingThinkTimeNetworkSpeedBrowsercache
noname3
noname3
Assoonas
possible
Asrecorded
Maximumbandwidth
Yes
Users'Influence
DisplaysaveragetransactionresponsetimesrelativetothenumberofVusersrunningatanygivenpointduringtheloadtest.ThisgraphhelpsyouviewthegeneralimpactofVuserloadonperformaneetimeandismostusefulwhenanalyzingaloadtestwhichisrunwithagradualload.
TransactionResponseTimeUnderLoad
Correlate
RunningVusers
AverageTransactionResponseTime
Granularity:
1Second
ColorScaleMeasurementMin.Ave.Max.SD
■
1
Action_Transaction
0.0
0.001
5.938
0.048
■
1
vuser_end_Transaction
0.0
0.013
0.672
0.094
■
1
vuser_init_Transaction
0.0
0.189
1.25
0.414
VuserLoadScheme
DisplaysthenumberofVusersthatexecutedVuserscripts,andtheirstatus,duringeachsecondofaloadtest.ThisgraphisusefulfordeterminingtheVuserloadonyourserveratanygivenmoment.
Title:
CurrentResults:
Filters:
GroupBy:
Granularity:
RunningVusers
C:
\DocumentsandSettings\Administrator'LocalSett
ings\Temp\noname3\res\res.lrr
16Seconds
VuserStatus=(Run)
Color
Scale
Measurement
GraphMin.
Graph
Ave.
Graph
Max.
Graph
Median
Graph
SD
■
1
Run
0.0
22.8
50
20
16.742
Color
Scale
Measurement
Min.
Ave.
Max.
SD
■
1
Action_Transaction
0.0
0.001
5.938
0.048
■
1
vuser_end_Transaction
0.0
0.013
0.672
0.094
■
1
vuser_init_Transaction
0.0
0.189
1.25
0.414
TransactionResponseTimes
Displaystheaveragetimetakentoperformtransactionsduringeachsecondoftheloadtest.Thisgraphhelpsyoudeterminewhethertheperformanceoftheserveriswithinacceptableminimumandmaximumtransactionperformancetimerangesdefinedforyoursystem.
RunningVusers
DisplaysthenumberofVusersthatexecutedVuserscripts,andtheirstatus,duringeachsecondofaloadtest.ThisgraphisusefulfordeterminingtheVuserloadonyourserveratanygivenmoment.
RunningVusers
C:
\DocumentsandSettings\Administrator'LocalSett
ings\Temp\noname3\res\res.lrr
VuserStatus=(Run)
Color
Scale
Measurement
GraphMin.
Graph
Ave.
Graph
Max.
Graph
Median
Graph
SD
■
1
Run
0.0
22.8
50
20
16.742
TransactionSummary
Displaysthenumberoftransactionsthatpassed,failed,stopped,orendedwitherrors.
Title:
CurrentResults:
TransactionSummary
C:
\DocumentsandSettings\Administrator'LocalSett
ings\Temp\noname3\res\res.lrr
Filters:
None
GroupBy:
AverageTransactionResponseTime
Displaystheaveragetimetakentoperformtransactionsduringeachsecondoftheloadtest.Thisgraphhelpsyoudeterminewhethertheperformanceoftheserveriswithinacceptableminimumandmaximumtransactionperformancetimerangesdefinedforyoursystem.
MeasuremeGraph'sGraph'sGraph's
ColorScale
ntMin.Ave.Max.
Graph'sGraph's
MedianSD
■
1
Action_Transaction
0.0
0.001
0.002
0.002
0.001
■
1
vuser_end_Transaction
0.0
0.004
0.019
0.0
0.008
■
1
vuser_init_Transaction
0.0
0.181
0.741
0.027
0.282
Terminology
LoadRunnerObjects
Term
Definition
VuserScripts
AVuserscriptdescribestheactionsthataVuserperformsduringtheseenario.EachVuserexecutesaVuserscriptduringascenariorun.TheVuserscriptsincludefunctionsthatmeasureandrecordtheperformaneeofyourapplication抯components.
LoadTest
Testsasystem'sabilitytohandleaheavyworkload.Aloadtestsimulatesmultipletransactionsorusersinteractingwiththecomputeratthesametimeandprovidesreportsonresponsetimesandsystembehavior.
Run-Time
Settings
Run-TimesettingsallowyoutocustomizethewayaVuserscriptisexecuted.Youconfiguretherun-timesettingsfromtheControllerorVuGenbeforerunningaseenario.YoucanviewinformationabouttheVusergroupsandscriptsthatwererunineachseenario,aswellastherun-timesettingsforeachscriptinascenario,intheSeenarioRun-TimeSettingsdialogbox.
Seenario
Aseenariodefinestheeventsthatoccurduringeachtestingsession.Forexample,aseenariodefinesandcontrolsthenumberofuserstoemulate,theactionsthattheyperform,andthemachinesonwhichtheyruntheiremulations.
Scheduler
TheScheduleBuilderallowsyoutosetthetimethatthescenariowillstartrunning,thedurationtimeoftheseenariooroftheVusergroupswithintheseenario,andtograduallyrunandstoptheVuserswithintheseenarioorwithinaVusergroup.ItalsoallowsyoutosettheloadbehaviorofVusersinascenario.
Session
WhenyouworkwiththeAnalysisutility,youworkwithinasession.AnAnalysissessioncontainsatleastonesetofseenarioresults(lrrfile).TheAnalysisutilityprocessesthescenarioresultinformationandgeneratesgraphsandreports.TheAnalysisstoresthedisplayinformationandlayoutsettingsfortheactivegraphsinafilewithan.Iraextension.Eachsessionhasasessionname,resultfilename,databasename,directorypath,andtype.
Transaetions
Atransactionrepresentsanactionorasetofactionsusedtomeasuretheperformaneeoftheserver.YoudefinetransactionswithinyourVuserscriptbyenclosingtheappropriatesectionsofthescriptwithstartandendtransactionstatement.
Vusers
VusersorvirtualusersareusedbyLoadRunnerasareplacementforhumanusers.Whenyourunaseenario,Vusersemulatetheactionsofhumanusersworkingwithyourapplication.Aseenariocancontaintens,hundreds,oreventhousandsofVusersrunningconcurrentlyonasingleworkstation.
GraphInformation
Term
Definition
Average
Averagevalueofthegraphmeasurement's.
Hits
ThenumberofHTTPrequestsmadebyVuserstotheWebserver.
Maximum
Maximumvalueofthegraphmeasurement's.
Measurement
Thisisthetypeofresourcebeingmonitore