LoadRunner



LoadRunner Internal Architecture:

  1. application servers under test are placed under stress by
  2. driver processes mdrv.exe (the Multi-threaded Driver Process) and r3vuser.exe which emulate application clients such as Internet Explorer web brower. It performs 3 main actions:
Kli> cpp (C language pre-processor)
    1. cci (C pre-compiling) which creaes a file with ci file, and
    2. execute using the driver for the protocol technology being tested.
Runs can be invoked to run "silently" by invoking Mdrv.exe from a Windows batch script.
Mdrv can automatically stop loading Vusers because they communicate with Vusers and monitor CPU usage on Windows Load Generator machines.
A separate JVM is instantiated by each Java-based Vuser on Windows-based machines. #Java Vusers are not supported on Unix platforms.
  1. virtual Vusers are invoked as groups (logical collection of virtual users running the same script on a specific load generator machine)
  2. by agents (3,900K magentproc.exe) running as a service or as a processon this page
  3. on load generator client machines.
  4. Each machine hosting agents maintains an Execution Log in a .qtp file.
  5. When logging is enabled, the agent also creates within the results folder a sequential log file for each Vuser (segregated by Vuser group).
  6. During execution, this file is displayed in the view > Show Output window on the LoadRunner Controller machine.
  7. Upon a pre-set delay, the Scheduler running on a Controller machine instructs agents (via Windows port 54345 or dynamic Unix port) to initiate test session scenarios. The Controller (wlrun.exe) sends a copy of scenario files along with the request.
  8. Agents are launched by the Remote Agent Dispatcher process (formerly called Remote Command Launcher (RCL)) on each load generator machine.
  9. Each agent refer to scenario (.lrs) definition files to determine which Vuser groups and scripts to run on host machines.
This means the Controller can be started from a DOS batch (.bat) file (preferrably with a short name on a root drive):
REM Start Controller:
SET M_ROOT=C:\Program Files\HP\LoadRunner\bin
cd %M_ROOT%
wlrun.exe -TestPath D:\Dev\Dev1.lrs -port 8080 -Run -DontClose
pause Press Ctrl-Z to keep this window or
    1. Including the -Run parameter is the same as manually pressing the "Start Scenario" automatically upon invocation. This is not a good idea because you may have to decide about collating the file from a previous run or want to change the output folder.
    2. This assumes that the system's environment PATH variableanother page on this site was updated to include where LoadRunner is installed.





  1. The Controller is invoked using parameter values within files in the Windows OS folder (WINNT for Windows 2000 and WINDOWS for Windows XP). The Windows folder is used because LoadRunner is designed to have only one instance of Controller running at a time on a machine.
To quickly switch among several applications, save a copy of LoadRunner's ini files after working on it within the Controller, then use Notepad to craft a batch file to copy application-specific versions of ini files before executing wlrun. An example of file copy actions for application XXX:
copy %LRDir%/config/wlrun7-XXX.ini   %LRDir%/wlrun7.ini
copy %LRDir%/config/wlrun7-XXX.dft   %LRDir%/wlrun7.dft
Prior to v9.0:
copy %WinDir%/wlrun7-XXX.ini   %WinDir%/wlrun7.ini
copy %WinDir%/wlrun7-XXX.dft   %WinDir%/wlrun7.dft
Some defaults you might want to change:
    • In the wlrun7.ini file file [output] section, MaxNumberOfOutputMessages= from 10000 to 100000 for long runs. This limits the number of output messages stored in the database.
    • MaxOutputUIRowsToShow limits the amount of messages/errors (lines) displayed in the Controller's Output window.
    • In the QTWeb.lrp file within the LoadRunner Program Files dat\protocols folder section [Vugen], add entry MaxThreadPerProcess=5 to limit the number of threads managed by each load generator mdrv.exe process.
Values for DefaultScenarioDir, DefaultScriptDir, DefaultResultDir, and [Recent File List] stored in the wlrun5.ini and wlrun7.dft files updated whenever values are changed within the Controller.
  1. he blocks of actions taken by each Vuser are
  2. defined in Vu scripts created using Loadrunner's VuGen.exe. When this program is invoked, it stores in the Windows folder a comparamui.INI file to save under "[LastTablesUsed]" a history of files and [ParamDialogDates] specified using menu option Insert > New Parameter > Dates.
VuGen stores and retrieves a vugen.ini file in the Windows folder. When using Java, enable additional debug options:
[DynaDlg]
JavaLevel=3
When using 8.0 scripts within VuGen 8.1, add to Vugen.ini:
[Editor]
OLDEDITOR = 1
VuGen opens in LR folder template/qtweb default.cfg and script files.
Vu scripts can be coded to use variable values obtained from parameter files external to the script.
I have a lot more on VuGenanother page on this site here
  1. During a run, execution results are stored to a results folder.
I prefer to set Results Settings to "Automatically create a results directory for each scenario execution." which means that LR will increment the name of the Results Name when I start a scenario runs. For example, a value of "Res11" will be automatically incremented to "Res12" or sometimes "Res11-1".
Errors are written to the output.mdb MS Access database. See the ASP page I have written to access this database
  1. Within each results folder, a "Log" folder is automatically created to contain a log file for each group. After a run, to view a log file from within the Controller, click Vusers buttonthen right-click on a group to select "Show Vuser Log".
  2. As a scenario is run, monitors maintain counters locally on each host.
  3. After a run, the "collate" process takes .eve and .lrr result files and creates in the results folder a temporary .mdb (MS-Access) database.
To prevent errors when processing large result files, use MSDE (Microsoft SQL Desktop Engine).
setup SAPWD="StrongPassword" INSTANCENAME="LR" SECURITYMODE=SQL DISABLENETWORKPROTOCOLS=0 /L*v path to log file
Using Windows Explorer, share the Data folder.
Then in Analysis Options > Database tab, use 8.3 names without spaces (indentified with DOS command DIR /X):
    • Input the SAPWD password specified above.
    • Logical Storage location: \\loadclient02\Data (the folder you shared)
    • Physical Storage Location: C:\PROGRA~1\MICROS~1\MSSQL\Data (not C:\Program Files\Microsoft SQL Server\MSSQL\Data)
    • Click "Test parameters". (This takes a few seconds)
  1. The Analysis Module (8,320K analysisu.exe)
  2. generates analysis graphs and reports using data from the .mdb database.
  3. The LoadRunner Results file results_name.lrr from each scenario run -- also called an Analysis document file -- is read by the Analysis program to display Percentile graphs.
  4. By default, the LRReport folder is created in the test analyst's local machine My Documents folder to store Analysis Session files.
  5. They can optionally be formated in HTML.
  6. Their format are controlled by a .tem template file.
  7. Optionally, Mercury's Remote Performance Monitoring (RPM) MS-IIS/ASP web server for LoadRunner 7.8 can be installed on a Windows 2000 server (Caution! but not on a Windows 2003 server) so that
  8. load test results to be viewed using a web browser.

    What is the difference between a process and a thread?

    Process is defined as the virtual address space and the control information necessary for the execution of a program while Threads are a way for a program to split itself into two or more simultaneously running tasks. In general, a thread is contained inside a process and different threads in the same process share some resources while different processes do not.
    In terms of Loadrunner, when we run Vuser as a process, LoadRunner creates 1 process called mmdrv.exe per Vuser. So if we have 10 Vusers, we will have 10 mmdrv.exe processes on our machines, while when we run Vuser as a thread, LoadRunner creates 1 thread per Vuser. So if we have 10 Vusers, then we will have 1 process with 10 threads running inside it if the limit is 10 threads per process.
    Running Vuser as a thread is more memory efficient that running Vuser as a process for obvious reasons that less memory resources are utilized when we run them as thread. I read somewhere that running as a process has an advantage that system becomes more stable.
    Note that while running Java Virtual User, JVM’s are loaded per process and will follow the same principle above.

    What is memory leak?

    A memory leak is a particular type of unintentional memory consumption by a computer program where the program fails to release memory when no longer needed. This condition is normally the result of a bug in a program that prevents it from freeing up memory that it no longer needs.This term has the potential to be confusing, since memory is not physically lost from the computer. Rather, memory is allocated to a program, and that program subsequently loses the ability to access it due to program logic flaws.

    What is a page fault?

    An interrupt that occurs when a program requests data that is not currently in real memory. The interrupt triggers the operating system to fetch the data from a virtual memory and load it into RAM.
    An invalid page fault or page fault error occurs when the operating system cannot find the data in virtual memory. This usually happens when the virtual memory area, or the table that maps virtual addresses to real addresses, becomes corrupt.

         *****************************************************************************
    HTML vs URL
    There are three types of recording mode/levels in LoadRunner. GUI-based, HTML based and URL based. For the uninitiated, recording levels tells you the amount of and what information is recorded during the recording process. As the title says, for this post we will keep focus on HTML based and
    URL based recording levels only and will touch upon GUI based mode, in a later post.
    1. HTML based mode, records script for every user action that is performed during recording (hmmm…sounds like QTP) while URL based mode records each and every browser request to the server and resources received from the server. Confused? ok, HTML based mode does recording as you perform clicks and doesn’t give you inside information like what is happening behind the recording while URL based mode records each and every step and emulate Javascript code.
    2. From the point1) above you can guess, HTML mode would have less correlation to do while URL mode has much more complex correlation requirements.
    3. HTML mode is smaller and is more intuitive to read as the statements are inside the functions corresponding to the user action performed. In the case of URL based, all statements gets recorded into web_url()
    4. HTML mode is recommended for browser applications while URL mode is recommended for non-browser applications.
    5. Lastly, don’t get the impression that I am advocating for HTML mode.URL mode can be of real help when you want to have control over the resources that need to be or need not to be downloaded, since you have each and every statement in-front of you (point 1)

    All about web_url and web_link in LoadRunner

    Points to note with web_url and web_link:
    • web_url is not a context sensitive function while web_link is a context sensitive function. Context sensitive functions describe your actions in terms of GUI objects (such as windows, lists, and buttons). Check HTML vs URL recording mode.
    • If web_url statement occurs before a context sensitive statement like web_link, it should hit the server, otherwise your script will get error’ed out.
    • While recording, if you switch between the actions, the first statement recorded in a given action will never be a context sensitive statement.
    • The first argument of a web_link, web_url, web_image or in general web_* does not affect the script replay. For example: if your web_link statements were recorded as 
           web_link("Hi There","Text=Hello, ABC", LAST);

    Now, when you parameterize/correlate the first argument to
             web_link("{Welcome to LearnLoadRunner}","Text=Hello, ABC", LAST);
    On executing the above script you won’t find the actual text of the parameter {Welcome to Learn LoadRunner} instead you will find {Welcome to Learn LoadRunner} itself in the execution log. However to show the correlated/parameterized data you can use lr_eval_string to evaluate the parameter.

         *****************************************************************************

    Few Quick Recording Techniques for Web (HTTP/HTML)

    There are situations where recording application using protocol Web (HTTP/HTML) encounters problem such as (1) not recording events, (2) not launching or (3) crashing. The context may deviate however the below list aims to provide a quick resolution to the problems. Obviously, the quick may work/not work in different environment and situations, however it will help you scope down the problem in a sequential and logical manner.
    1. Use another machine to record
    2. Use web_custom_request
    3. Configure Port Mappings using “WinInetlevel data” or “Socket level and WinInet level data”. And if necessary, define the port and certificates.
    4. Use Older Recording Engine
    5. Use LoadRunner as Proxy Server on port 7777 for Recording (For Older Recording Engine)
    6. Determine OS Support Status and application type
    7. Determine the actual protocol and port number using Winsock protocol or network sniffing tools (WireShark Network Analyzer)
    Network Analysis and Sniffing (Point 7)

    What Is Network Analysis and Sniffing? 

    Network analysis (also known as traffic analysis, protocol analysis, sniffing, packet analysis, eavesdropping, and so on) is the process of capturing network traffic and inspecting it closely to determine what is happening on the network. A network analyzer decodes the data packets of common protocols and displays the network traffic in readable format. 

    A Sniffer is a program that monitors data traveling over a network. Unauthorized sniffers are dangerous to network security because they are difficult to detect and can be inserted almost anywhere, which makes them a favorite weapon of hackers.
    A network analyzer can be a standalone hardware device with specialized software, or software that is installed on a desktop or laptop computer. The differences between network analyzers depend on features such as the number of supported protocols it can decode, the user interface, and its graphing and statistical capabilities.
    Other differences include inference capabilities (e.g., expert analysis features) and the quality of packet decodes. Although several network analyzers decode the same protocols, some will work better than others for your environment



    The Figure below shows the Wireshark Network Analyzer display windows. A typical network analyzer displays captured traffic in three panes:
    • Summary: This pane displays a one-line summary of the capture. Fields include the date, time, source address, destination address, and the name and information about the highest-layer protocol.
    • Detail: This pane provides all of the details (in a tree-like structure) for each of the layers contained inside the captured packet.
    • Data: This pane displays the raw captured data in both hexadecimal and text format.
         ****************************************************************************

    IP Spoofing

    Spoofing gives a meaning ‘a composition that imitates or misrepresents somebody's style, usually in a humorous way’.  Commenting in a technical way, it can be defined as ‘An attempt to gain access to a system by posing as an authorized user’.
     Now, looking at what is IP Spoofing, imitating or masquerading an IP is IP Spoofing.
     In computer networking, this term refers to the creation of Internet Protocol (IP) packets with a forged source IP address, with the purpose of concealing the identity of the sender or impersonating another computing system.

     What is Load Balancing?

    Load balancing is a technique to distribute workload evenly across two or more computers or other resources, in order to get optimal resource utilization, minimize response time, and avoid overload. Using multiple components with load balancing, instead of a single component (one load balancer), may increase reliability.
     The load balancing service is usually provided by a dedicated program or hardware device. It is commonly used to mediate internal communications in computer clusters, especially high-availability clusters. If the load is more on a server, then the secondary server takes some load while the other is still processing requests.

     Configuring IP Spoofing in Load runner

     Internal IP addresses (such as 192.168.1.1) may need to be allocated by the organization's Network Administrator unless you're working in a closed network. The IP Wizard program (from LoadRunner) is used to define multiple IP addresses on each load generator host
    1. When a host machine is re-started, routing tables are updated with the new addresses. The IP Wizard program creates a batch file (nt_routing.bat for Windows and unix_routing.bat for UNIX machines) and .ips file which updates IP tables
    2. After turning IP spoofing on (or off), for the setting to take effect, the Load Generator needs to be disconnected and reconnected again.
    3. To enable multiple IP Addressing,
      1. At the Load Runner Controller level:  Select the menu item Scenario; check "Enable IP Spoofer". Check "Expert mode" on the Tools drop-down menu. This enables "Multiple IP address mode" in the Options dialog ‘General’ tab.
      2. At Performance Center Level:  Open the load test and on the General Tab, check the ‘Enable IP Spoofer’.
         *****************************************************************************