2007年2月14日 星期三

LoadRunner的工作原理(第一部分)


Architecture Overview

    LoadRunner works by creating virtual users who take the place of real users operating client software, such as Internet Exploreranother page on this site sending requests using the HTTP protocol to IIS or Apache web servers.

    Requests from many virtual user clients are generated by "Load Generators" in order to create a load on various servers under teston this page

    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 readanother page on this site using Microsoft Accessanother page on this site

Set screen Virtual Users (Vusers)

    Unlike a WinRunneranother page on this site workstation which emulates a single user's use of a client, LoadRunner can emulate thousands of Virtual Users.

    Load generators are controlled by VuGen scripts which issue non-GUI API calls using the same protocols as the client under test. But WinRunner GUI Vusers emulate keystrokes, mouse clicks, and other User Interface actions on the client being tested Only one GUI user can run from a machine unless LoadRunner Terminal Services Manager manages remote machines with Terminal Server Agent enabled and logged into a Terminal Services Client session.

    During run-time, threaded vusers share a common memory pool. So threading supports more Vusers per load generator.

    The Status of Vusers on all load generators start from "Running", then go to "Ready" after going through the init section of the script. Vusers are "Finished" in passed or failed end status. Vusers are automatically "Stopped" when the Load Generator is overloaded.

    No additional license is needed to monitor standard web (HTTP) servers (Apache, IIS, and Netscape).

    To use Web Services Monitors for SOAP and XML, a separate license is needed, and vUsers require the Web Services add-in installed with Mercury Feature Pack (FP1)




Set screen Product Versions

    Version 8.1 Feature Pack 4 patch installer LR81FP4P136.exe at 7,786,800 bytes, was signed on January 2, 2007 as file 8.1.4.0 (Build: 1735) is Recorder Version: 1290.

    Version 8.1 Feature Pack 4 installer LR81FP4.exe, at 194,644,720 bytes, was signed on December 15, 2006 as file version 8.1.4.0 (Build: 2249) is Recorder Version: 1289. This requires an upgrade to MS.NET 2.0 clients.

    Version 8.1 Feature Pack 3 installer LR81FP3.exe, at 116,601,240 bytes, was signed on June 18, 2006 as file version 8.1.3.0 (Build 2085). It installs (as an item on your Start > Program Files) Microsoft WSE (Web Services Enhancements) 2.0 SP3 to deploy security policies for sytems running .NET Framework 1.1.

    Version 8.1 became available October 2005. In VuGen it adds a "Workflow View", "Workflow Wizard", and a memory leak which is fixed with a patch downloadable since Dec. 2005. It renames the VuGen "Execution Log" the "Replay Log".

    Version 8.0 became available August 2004. It adds "Additional Attributes" to Runtime Settings. It also adds (for additional fee) diagnostics and tuning capabilities, allowing Transaction Breakdown to breakdown transaction times across different servers servicing various transaction layers (web server, Oracle 11i & Peoplesoft 8 app server, database) layers. It separates SQL time in execute, parse, and fetch times.

    Version 7.8 Feature Pack 1 added support for Windows XP.

    Version 7.8 became available September 2003.

    Version 6.5 available June 2000 offered new "TurboLoad" technology -- a completely new replay engine that runs thousands of vusers using a single operating system thread.

    Version 6.0 used a separate thread per user, which required almost 10 times more i/o and CPU cycles than 6.5.





Note: Links to documents that used to be here were removed after Mercury Interactive, Inc. lawyers demanded their removal. Page numbers in online pdf files are different (have more pages) than page numbers in the paper document of the same title.




Set screen Application Components' Requirements

    Loadrunner makes use of four executables with different webpage article system requirements

    Application
    Product
    Process
    Image Name
    V8.0
    Img
    KB
    File
    Size
    - LRLauncherApp.exe 16,288 n/a
    Virtual User Generatoron this page VuGen.exe 12,436 2,334,769
    Controlleron this page with On-Line Monitors wlrun.exe 13,076 5,681,215
    Load Generator Agenton this page magentproc.exe 3,236
    magentservice.exe
    65,536
    mdrv.exe

    Analysison this page Analysisui.exe 13,132 6,058,496
    Tuning Consoleon this page 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 MS Excel spreadsheetLR 7.8 Footprints.xls reports that to run Web requires __ per process and __ per thread.

Go to Top of this page.
Previous topic this page
Next topic this page

Set screen Using Windows Remote Desktop Connection

    Caution! Remote Desktop Connection (part of the Terminal Services that comes with Winodows XP) is not as reliable with LoadRunner as Remote Administrator.

    To keep Windows Remote Desktop Connection sessions from timing out during a test, the Terminal Services on each machine should be configured as follows:

    1. Click Start, point to Programs (or Control Panel), Administrative Tools and choose Terminal Services Configuration.
    2. Open the Connections folder in tree by clicking it once.
    3. Right-click RDP-Tcp and select Properties.
    4. Click the Sessions tab.
    5. Make sure "Override user settings" is checked.
    6. Set Idle session limit to the maximum of 2 days instead of the default 2 hours.
    7. Click Apply.
    8. Click OK to confirm message "Configuration changes have been made to the system registry; however, the user session now active on the RDP-Tcp connection will not be changed."

    Caution! Make sure that when you do this you're not violating one of your corporation's security policies.

    Caution! Terminal Server only allows two simultaneous connections. To disconnect from a session, do not click "X" on the remote desktop window but click Start and Log Off.









Among Common problems installing LoadRunner: Windows 2003 & XP SP2 have a DEP (Data Execution Prevention) feature which prevents VuGen recording. Go to Control Panel, System -> Advanced tab, Performance section "Settings" button Data Execution Prevention tab and add the client program or choose "Turn on DEP for essential windows programs and services only." A reboot is required.

Set screen LR Installation and Configuration

    Download [after required registration] the 10 day trial from here or here.

      Idea I recommend that you put downloaded LoadRunner installation files and patches to a separate media such as a CD or USB drive. Then mark those files as read-only.

      Disable your anti-virus software (Symantec, McAfee, etc.) before invoking on installers.

      Caution Virus Detection engines (such as Hauri versions since May 18) may find that program regtlb.exe (which registers/unregisters type libraries) to contain a "virus" they call "Backdoor.Win32.PoeBot.15872". Automatic repair by the virus remover will break those files.

    The LR box comes with two CD's and this installation manual. Separate installation manuals are available for the Controller and Analysis modules.

    The Windows CD autostarts to this initial screen for v7.8 screen captured and this initial screen for v8.0 screen captured

      You can install just a single component (such as VuGen) by (ironically) selecting "Full install" and then the "Custom" option to check the specific components to install. However,
      Caution! due to a strange bug with v8.0, before you do that, first install the Load Generator, then return to install "custom" components.

    The UNIX CD installs only the Load Generator (not the Controller or VuGen) on UNIX machines because the Controller and VuGen only run on Windows machines.

    Idea Zero fill machine names to t001, ... t010, etc. The LR Controller sorts machines named t1, t2, ... t10 as t1, t10, t2.

    Set screen Location of Program Files

    The LoadRunner installation program adds files in Program Files, Windows folder, and the Windows Registryanother page on this site that are NOT removed during un-installation.

    If you get a "License violation" message, you need to get from Mercury support a one-day license key to install with.

    By default, different versions of LoadRunner are installed to different parts of your hard disk:

      LoadRunner 8.1 executable files are installed to file path
      "C:\Program Files\Mercury\LoadRunner\bin"

      LoadRunner 8.0 "stutters" when it installs to its default file path
      "C:\Program Files\Mercury Interactive\Mercury LoadRunner\bin"

      Note: Even though 8.0 uses a different folder, folders created by previous versions still need to be removed before its installation.

      LoadRunner 7.8 executable files are installed to file path
      "C:\Program Files\Mercury Interactive\LoadRunner\bin"

    When working with Java, instead of overridding these default installation folder to a path without spaces (such as C:\LR78) as recommended by Mercury KnowledgeBase article KB article 11878, just use the equivalent DOS 8.3 file names:

    Idea To quickly get at this LoadRunner installation folder, create an environment variableanother page on this site named "LR81" so you can use a quick command such as

       cd %lr81% 

    To get at this folder quickly, I created a batch file named "L.bat" in the cmd's default C:\ root folder containing this:

      cd \Program Files\Mercury\LoadRunner\bin

      pause
      I created a shortcut to this file on my desktop and dragged it over Windows so that I can click into that folder from anywhere. The pause command ensures that the command window does not disappear automatically. Alternately, from within a command window I can just type "L" and press Enter.

    Set screen Files in Windows Folders

  1. This path specified is stored under [ProductEnv] as M_ROOT in file wlrun.ini in the C:\WINNT (or C:\Windows) folder.

    The C:\WINNT (or C:\Windows) folder also holds the Maintenance Number (MPN) specified during installation, stored as a parameter named "LoadRunner_SerialNumber" (such as 1234-1234567890) in the mercury.ini file.

    Set screen Start Menu

    The LR installer adds links to the most used programs in

      > Programs > Mercury Interactive > LoadRunner

    However, some programs are installed which are not conveniently listed there, such as
    tool WDiff.exe v1.49 to compare differences between two ASCII text files. It has an accompanying help file

    Beginning with v7, LoadRunner prevents software piracy (much like Microsoft began doing with Windows XP) by requiring that a license key be provided within 10 days of installation. Mercury generates its license key based on a host ID generated on each computer. CPT12784.doc

    With v7.x, to generate Generate a HostID key (such as "XCCWJU-APBE-BYDS") click down

      Programs > Mercury LoadRunner > LoadRunner > License tab

      The key can be obtained before installation from program licidgenerator.exe and (after registration) its lm70.dll from the installation CD folder \lrunner\lm70.nt\bin or \lrunner\setup\lm70.nt\bin.

    Set screen Sample Apps / Protocols

    Running the samples install program populates folder

      C:\Program Files\Mercury Interactive\Mercury LoadRunner\

    Copy the link location below into the "Program to record:" field:

    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
    ODBCanother page on this site (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 CORBAA website external to this site
    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 \bin to the path and try again. [MsgId: MERR-22996]
      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

      Idea 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.

      Reminder The Zip file is equivalent to a JAR file in Unix systems.

      Caution! 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
    Caution! The location of the JDK needs to be specified in the Windows PATH environment variable PATHanother page on this site to avoid this message:
      Error: Failed to find javac.exe Java Compiler in Path and JDK installation folder in registry. [MsgId: MERR-22981]
    Reminder VuGen "Java Vusers" can only operate as Single Vuser mode (not multi-vuser).

    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

    Caution! To uninstall LoadRunner, you must be logged in with the same Windows userID as was used during original installation! If you use a different userid, the uninstall will delete only the dat folder which contains the "miuninst" file.

    Unlike Microsoft Office applications, Mercury has not programmed invididual components to be selectively uninstalled on its own.

2 Comments:

匿名 said...

[url=http://firgonbares.net/][img]http://firgonbares.net/img-add/euro2.jpg[/img][/url]
[b]discount software for education, [url=http://firgonbares.net/]teacher discount software[/url]
[url=http://firgonbares.net/][/url] software at a discount price camera software
software discounts uk [url=http://firgonbares.net/]acdsee pro photo[/url] buy software canada
[url=http://firgonbares.net/]order form software[/url] Mac Parallels Desktop
[url=http://firgonbares.net/]buy software australia[/url] nero dmc
CS4 Extended Mac Retail [url=http://firgonbares.net/]softwares for sale[/b]

匿名 said...

Can anyone recommend the best Managed Service program for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central MSP tool
? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!