1、性能测试工具LoadRunner实验报告性能测试工具 LoadRunner 实验报告一、概要介绍1.1软件性能介绍1.1.1软件性能的理解性能是一种指标, 表明软件系统或构件对于其及时性要求的符合程度; 同时也是产品的 特性,可以用时间来进行度量。表现为:对用户操作的响应时间;系统可扩展性;并发能力;持续稳定运行等。1.1.2软件性能的主要技术指标 响应时间:响应时间 =呈现时间 +系统响应时间 吞吐量:单位时间内系统处理的客户请求数量。 (请求数 /秒,页面数 /秒,访问人数 / 秒) 并发用户数:业务并发用户数; 注意 系统用户数: 系统的用户总数; 同时在线用户人数: 使用系统过程中同时
2、在线人数达 到的最高峰值。1.2LoadRunner 介绍LoadRunner 是 Mercury Interactive 的一款性能测试工具,也是目前应用最为广泛的性能测试工具之一。 该工具通过模拟上千万用户实施并发负载, 实时性能监控的系统行为 和性能方式来确认和查找问题。1.2.1 LoadRunner 工具组成虚拟用户脚本生成器: 捕获最终用户业务流程和创建自动性能测试脚本, 即我们在以后说的 产生测试脚本;压力产生器:通过运行虚拟用户产生实际的负载; 用户代理:协调不同负载机上虚拟用户,产生步调一致的虚拟用户; 压力调度:根据用户对场景的设置,设置不同脚本的虚拟用户数量; 监视系统:
3、监控主要的性能计数器; 压力结果分析工具:本身不能代替分析人员,但是可以辅助测试结果的分析。1.2.2LoadRunner 工具原理代理( Proxy )是客户端和服务器端之间的中介人, LoadRunner 就是通过代理方式截获 客户端和服务器之间交互的数据流。1)虚拟用户脚本生成器通过代理方式接收客户端发送的数据包,记录并将其转发给服 务器端;接收到从服务器端返回的数据流,记录并返回给客户端。这样服务器端和客户端都以为在一个真实运行环境中, 虚拟脚本生成器能通过这种方式 截获数据流; 虚拟用户脚本生成器在截获数据流后对其进行了协议层上的处理, 最终用脚本 函数将数据流交互过程体现为我们容易
4、看懂的脚本语句。2)压力生成器则是根据脚本内容,产生实际的负载,扮演产生负载的角色。3)用户代理是运行在负载机上的进程,该进程与产生负载压力的进程或是线程协作, 接受调度系统的命令,调度产生负载压力的进程或线程。4)压力调度是根据用户的场景要求,设置各种不同脚本的虚拟用户数量,设置同步点等。5)监控系统则可以对数据库、应用服务器、服务器的主要性能计数器进行监控。6)压力结果分析工具是辅助测试结果分析。二、 LoadRunner 测试过程2.1 计划测试 定义性能测试要求,例如并发用户的数量、典型业务流程和所需响应时间等。2.2创建 Vuser 脚本 将最终用户活动捕获(录制、编写)到脚本中,
5、并对脚本进行修改,调试等。协议类型:取决于服务器端和客户端之间的通信协议; 脚本类型: init (初始部分) ,Action (事务部分) ,end (退出结束) ; 脚本录制:捕获应用程序所执行的操作; 验证回放:检查是否准确模拟了录制的会话; 事务:表示要度量的最终用户业务流程; 参数化:将录制的一些常来替换为参数;内容检查: LR 只检测到网页的响应,就认为是 pass 而不管当前网页的正确性,所以设置检 查点,确保在测试时结果的正确性;迭代次数: action 部分的循环次数。2.3创建场景对 Vuser 脚本进行场景设置和负载环境设置。 场景类型手动场景:通过定义 Vuser 组,
6、 Vuser 脚本和运行脚本的负载生成器来创建场景; 百分比模式:定义场景中要使用的 Vuser 总数,负载生成器计算机以及要分配给每个 Vuser 脚本的 Vuser 占总数的百分比。面向目标的场景;定义你希望的测试目标, LR 会根据这些目标自动构建场景。编辑计划:设置加压方式、压力持续时间和减压方式等。场景组:选择组 / 脚本,虚拟用户数量以及负载生成器等。 运行时设置:对脚本进行运行时属性设置。三、实验过程1)安装完成进入 Loadrunner 主界面lxLoad Testing(3)点击 Vuser下的Start Recording,出现如下界面:St art Recording输入
7、URL地址,开始录制脚本。 Vuser init 是录制脚本的起始点;Actio n 是录制脚本的活动; Suser end 是录制脚本的终止点;(4)脚本录制完之,点击 Tools工具栏下的 Create Controller Seenario选项,会出现脚本的运行次数,确定后会出现如下界面:此界面是规划脚本的开始数目,开始时间,驻留时间,退出时间,同时退出的数目等。点击Edit scheduler按钮出现如下所示界面;Schedule BuilderSchedule NsmeDef dull ScheduleNew. I) Bename I DeleteK I Cane 日 也 b | S
8、chedule DefiriicinRamp Vp | Duration Eimp DownLoad SellingsLoad all Vusas sirmtafieously(* Start )5 Vusers every |0000:15 Initialize alVunrs before Run.(seledihg Ibis option means thal running begins only afler alVuser reach the Ready state1.Ramp UP上图所示为每15秒运行5个脚本;2.Durati on计划每个脚本的驻留时间;3.Ramp Dow n
9、规定每隔多长时间退出多少数目; 点击OK,出现下图界面;(5)开始压力负载测试:图示数据只为说明,并不是实验真实数据rMercury LoadRuiuier Controller - Scenario!1 - Run0IFile Mcnitprs Revolts Rihowtits Tqc|.s HtlpMM ilb衲菇rf図 Design S Run Aula Colltia Reu四、实验结果:Executive SummaryObjectives Add text hereSeen ario Summary10 minu tes and 20 sec onds.50Total Durat
10、i on (in eludi ng Ramp Up/Dow n):Maximum Running Vusers:Total Throughput (bytes):Total Hits:Top Time-C on sumi ng Tran sact ionsTran saction Name Ave 90%vuser_i ni t_Tra nsactio n0.1890.675vuser_e nd_Tra nsactio n0.0130.013Action Tran sact ion0.0010Con clusi onsAdd text hereSeen ario Con figurati on
11、FilesResults in Sessi on:C:Docume nts and Sett in gsAdmi nistratorLocal Sett in gsTempn on ame3resres.lrrSessi on Name:Sessi on 1.lraName:Seen ariolScheduler In formatio nDuratio n:Load Behavior:Run for 000:05:00 (hhh:mm:ss)Start 5 Vusers every 00:00:15 (hh:mm:ss)En ded On:30-11-2008 14:55:29Scripts
12、Script Type Filenon ame3QTWebC:Docume nts and Sett in gsAdmi nistratorLocalSett in gsTempno name3no name3.usrRun Time Sett ingsQTWebGroup Script Pacing Thi nk Time Network Speed Browser cachenon ame3non ame3As soon aspossibleAs recordedMaximum ban dwidthYesUsers InfluenceDisplays average transaction
13、 response times relative to the number of Vusers running at any given point during the load test. This graph helps you view the general impact of Vuser load on performa nee time and is most useful whe n an alyz ing a load test which is run with a gradual load.Tran sact ion Resp onse Time Un der Load
14、CorrelateRunning VusersAverage Tran sact ion Resp onse TimeGran ularity: 1 SecondColor Scale Measureme nt Min. Ave. Max. SD1Action_Tran sact ion0.00.0015.9380.0481vuser_e nd_Tra nsact ion0.00.0130.6720.0941vuser_i ni t_Tra nsacti on0.00.1891.250.414Vuser Load SchemeDisplays the number of Vusers that
15、 executed Vuser scripts, and their status, during each second of a load test. This graph is useful for determining the Vuser load on your server at any given mome nt.Title:Current Results:Filters:Group By:Gran ularity:Running VusersC:Docume nts and Sett in gsAdmi nistratorLocal Settin gsTempno name3
16、resres.lrr16 SecondsVuser Status = (Run)ColorScaleMeasurem entGraph Mi n.GraphAve.GraphMax.GraphMedia nGraphSD1Run0.022.8502016.742ColorScaleMeasureme ntMi n.Ave.Max.SD1Action_Tran sact ion0.00.0015.9380.0481vuser_e nd_Tra nsact ion0.00.0130.6720.0941vuser_i ni t_Tra nsacti on0.00.1891.250.414Transa
17、ction Response TimesDisplays the average time taken to perform transactions during each second of the load test. This graph helps you determine whether the performance of the server is within acceptable minimum and maximum transaction performance time ranges defined for your syste m.Running VusersDi
18、splays the number of Vusers that executed Vuser scripts, and their status, during each second of a load test. This graph is useful for determining the Vuser load on your server at any given mome nt.Running VusersC:Docume nts and Sett in gsAdmi nistratorLocal Settin gsTempno name3resres.lrrVuser Stat
19、us = (Run)ColorScaleMeasurem entGraph Mi n.GraphAve.GraphMax.GraphMedia nGraphSD1Run0.022.8502016.742Tran sacti on SummaryDisplays the nu mber of tran sact ions that passed, failed, stopped, or en ded with errors.Title:Current Results:Tran sacti on SummaryC:Docume nts and Sett in gsAdmi nistratorLoc
20、al Settin gsTempno name3resres.lrrFilters:NoneGroup By:Average Transaction Response TimeDisplays the average time taken to perform transactions during each second of the load test. This graph helps you determine whether the performance of the server is within acceptable minimum and maximum transacti
21、on performance time ranges defined for your syste m.Measureme Graphs Graphs GraphsColor Scalent Min. Ave. Max.Graphs GraphsMedia n SD1Action_Tra n sact ion0.00.0010.0020.0020.0011vuser_e nd_ Tran sacti on0.00.0040.0190.00.0081vuser_i nit_ Tran sacti on0.00.1810.7410.0270.282Termino logyLoadR unner O
22、bjectsTermDefin iti onVuser ScriptsA Vuser script describes the actions that a Vuser performs during the seenario. Each Vuser executes a Vuser script during a scenario run. The Vuser scripts include functions that measure and record the performanee of your application 抯 comp onen ts.Load TestTests a
23、 systems ability to han dle a heavy workload. A load test simulates multiple transactions or users interacting with the computer at the same time and provides reports on response times and system behavior.Run- TimeSetti ngsRun-Time settings allow you to customize the way a Vuser script is executed.
24、You con figure the run-time sett ings from the Con troller or VuGe n before running a seenario. You can view information about the Vuser groups and scripts that were run in each seenario, as well as the run-time settings for each script in a scenario, in the Seenario Run-Time Settings dialog box.See
25、n arioA seenario defines the events that occur during each testing session. For example, a seenario defines and controls the number of users to emulate, the actions that they perform, and the mach ines on which they run their emulati ons.SchedulerThe Schedule Builder allows you to set the time that
26、the sce nario will start running, the durati on time of the seen ario or of the Vuser groups with in the seen ario, and to gradually run and stop the Vusers with in the seen ario or with in a Vuser group. It also allows you to set the load behavior of Vusers in a sce nario.Sessi onWhen you work with
27、 the An alysis utility, you work with in a sessi on. An An alysis session contains at least one set of seenario results (lrr file). The Analysis utility processes the sce nario result in formati on and gen erates graphs and reports. The An alysis stores the display in formati on and layout sett ings
28、 for the active graphs in a file with an .Ira extension. Each session has a session name, result file name, database n ame, directory path, and type.Tran saeti onsA transaction represents an action or a set of actions used to measure the performa nee of the server. You defi ne tran sact ions with in
29、 your Vuser script by en clos ing the appropriate sect ions of the script with start and end tran sact ion stateme nt.VusersVusers or virtual users are used by LoadR unner as a replaceme nt for huma n users. When you run a seen ario, Vusers emulate the acti ons of huma n users work ing with your app
30、lication. A seenario can contain tens, hundreds, or even thousands of Vusers running con curre ntly on a sin gle workstati on.Graph In formatio nTermDefi niti onAverageAverage value of the graph measureme nts.HitsThe nu mber of HTTP requests made by Vusers to the Web server.MaximumMaximum value of the graph measureme nts.Measureme ntThis is the type of resource being mon itore
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2