HP Mercury LoadRunner 是一款功能相当强大的性能测试工具,由三个部分构成, VUGen, Controller以及Analysis. 其中VUGen负责进行脚本录制, Controller是一个总控中心,负责场景的配置,监控器的选取和监控,并选择合适的负载生成器进行执行, Analysis是一个分析模块,主要负责所有执行数据的分析以及报告的生成.
之所以说LoadRunner是强大的性能测试工具,主要是因为VUGen支持大概好几十种主流的协议. 因此支持的被测对象相当广泛,另外Analysis也有超强的功能,提供非常丰富的图表,供测试结束之后分析和定位问题.
我使用Mercury LoadRunner有一年左右,2006年6月通过了LoadRunner的SP考试,并于12月底参加了CPC考试,以2分之差失败. 在这一年之内对Controller和Analysis的使用有一些心得和体会,大概能看懂一些主要的分析图表,包括事务相关的一些图表,所以希望作一个总结,对希望学习和了解LoadRunner的朋友有一些帮助. 因为时间有限,所以初步打算以系列的形式发表. 下次打算介绍Analysis提供图表的概述.
--to be continued
2007年2月15日星期四
| [+/-] |
LoadRunner性能数据结果分析连载(引言) |
2007年2月14日星期三
| [+/-] |
LoadRunner的工作原理(第二部分) |
LoadRunner Internal Architecture
| |
| |
|
| [+/-] |
LoadRunner的工作原理(第一部分) |
Architecture Overview
Requests from many virtual user clients are generated by "Load Generators" in order to create a load on various servers under test These load generator agents are started and stopped by Mercury's "Controller" program. The Controller controls load test runs based on "Scenarios" invoking compiled "Scripts" and associated "Run-time Settings". Scripts are crafted using Mercury's "Virtual user script Generator" (named "V U Gen"), It generates C-language script code to be executed by virtual users by capturing network traffic between Internet application clients and servers. With Java clients, VuGen captures calls by hooking within the client JVM. During runs, the status of each machine is monitored by the Controller. At the end of each run, the Controller combines its monitoring logs with logs obtained from load generators, and makes them available to the "Analysis" program, which can then create run result reports and graphs for Microsoft Word, Crystal Reports, or an HTML webpage browser. Each HTML report page generated by Analysis includes a link to results in a text file which Microsoft Excel can open to perform additional analysis. Errors during each run are stored in a database which can be read |
|
| Note: Links to documents that used to be here were removed after Mercury Interactive, Inc. lawyers demanded their removal. |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Application Product | Process Image Name | V8.0 Img KB | File Size | |
|---|---|---|---|---|
| | - | LRLauncherApp.exe | 16,288 | n/a |
| | Virtual User Generator | VuGen.exe | 12,436 | 2,334,769 |
| | Controller | wlrun.exe | 13,076 | 5,681,215 |
| | Load Generator Agent | magentproc.exe | 3,236 | |
| magentservice.exe | | 65,536 | ||
| mdrv.exe | | |||
| | Analysis | Analysisui.exe | 13,132 | 6,058,496 |
| | Tuning Console | protune.exe | | 3,403,833 |
Console programs
| perl5.8.0.exe | Interpreter | 20,535 |
| regtlb.exe | registers the batch automation type library | 30,720 |
| sed.exe | 55,296 | |
| wdiff.exe | Compares text files | 197,632 |
Alex Arbitman's LR 7.8 Footprints.xls reports that to run Web requires __ per process and __ per thread.
| |
|
| Protocol | Server | Client Program | Parameter | Notes |
|---|---|---|---|---|
| Web | WebTours\StartServer.bat | http://localhost:1080/mercuryWebTours | | |
| COM/DCOM | (Operating System) | samples\bin\frsui.exe | | |
| Winsock | sockfrs.exe | samples\bin\flights.exe | Winsock WinSockWeb | |
| ODBC | (MS Access) | samples\bin\flights.exe | ODBC_Access | |
| CORBA | samples\CorbaSamples\server.cmd & samples\CorbaSamples\server.bat | samples\CorbaSamples\client.cmd & samples\Corbasamples\clientrecord.cmd | | Stuart Moncrieff's article on CORBA |
| RMI | samples\RMISamples\server.cmd & samples\RMISamples\server.bat | samples\RMISamples\client.cmd & samples\RMISamples\clientrecord.cmd | |
According to CPT11877.doc, JDK 1.5 users need to contact Mercury Support for a patch to each specific LoadRunner version (7.6, 7.8 FP1 or 8.0). Otherwise, you'll get these messages:
- Error: Failed to find javac.exe Java Compiler in Path and JDK installation folder in registry. [MsgId: MERR-22981]
Error: Failed to compile the Actions.java file. Please add the
Warning: Extension java_int.dll reports error -1 on call to function ExtPerProcessInitialize [MsgId: MWAR-10485]
Error: Thread Context: Call to service of the driver failed, reason - thread context wasn't initialized on this thread. [MsgId: MERR-10176]
The Java sample apps use the "flight32lr" User Data Source with Microsoft Access driver(*.mdb) in the USER DNS table in Data Sources(ODBC) of the VuGen's local machine.
Additionally, the sample Java servers must be operational prior to starting the client. This is done with the "samples\RMISamples\server.cmd":
- set lrpath=C:\PROGRA~1\Java\jre1.5.0_02\bin;C:\PROGRA~1\MERCUR~1\MERCUR~1\classes
set lrclasspath=C:\PROGRA~1\MERCUR~1\MERCUR~1\classes;C:\PROGRA~1\MERCUR~1\MERCUR~1\classes\srv;C:\PROGRA~1\Java\jre1.5.0_02\lib\rt.jar
set flightRmi=%~dp0;%~dp0RmiSamples.zip
set classpath=%lrclasspath%;%flightRmi%;C:\PROGRA~1\Java\lib\rt.jar;.;%classpath%
set path=%lrpath%;.;%path%
cd %~dp0
start java -Djava.security.policy="%~dp0RmiFlights.policy" RmiFlights.Server
Note the location of loadrunner class files I added to the default sample. They are pre-pended to the existing classpath.
Note that there are no spaces in the file path.
The Zip file is equivalent to a JAR file in Unix systems.
Do not delete the black command window because the Java server runs within it.
CORBA and RMI Java clients are invoked with a command for Windows to start the java.exe program. This "samples\RMISamples\client.cmd" file contains:
- set lrpath=C:\PROGRA~1\Java\jdk1.5.0_02\bin;C:\PROGRA~1\MERCUR~1\MERCUR~1\classes
set lrclasspath=C:\PROGRA~1\MERCUR~1\MERCUR~1\classes;C:\PROGRA~1\MERCUR~1\MERCUR~1\classes\srv;C:\PROGRA~1\Java\jdk1.5.0_02\lib\rt.jar
set flightRmi=%~dp0;%~dp0RmiSamples.zip
set classpath=%lrclasspath%;%flightRmi%;C:\PROGRA~1\Java\jdk1.5.0_02\lib\rt.jar;.;%classpath%
set path=%lrpath%;.;%path%
cd %~dp0
start java RmiFlights.main
Note that the RmiFlights.main class file name is passed into java for it to load.
When recording Java with VuGen, a different command — such as the sample clientRecord.cmd — needs to be invoked because VuGen needs to be invoked within the JVM sandbox:
- set flightRmi=%~dp0;%~dp0RmiSamples.zip
set classpath=%flightRmi%;%classpath%
cd %~dp0
start InvokeVugen.exe
- Error: Failed to find javac.exe Java Compiler in Path and JDK installation folder in registry. [MsgId: MERR-22981]
Instead of web "Start recording", Java VuGen scripts invoke Java functions within the Actions section.
"vuser_init" and "vuser_end" actions are not relevant within Java VuScripts.
Internally, the cjhook.ini file specifies which Java classes can hook in its [EXC_SYSTEM_CL] section. Java classes specified in the [SYSTEM_CL] section are not hooked.
The user.hooks file in LR \bin folder is a general format and cannot be used as-in. It needs to be copied.
Uninstall
Unlike Microsoft Office applications, Mercury has not programmed invididual components to be selectively uninstalled on its own.
