Search TWGer

Monday, June 16, 2008

Preparing Performance Test using Mercury Load Runner Part - I

Overview

Load Runner is a performance test tool from Mercury Load Runner (now HP) widely used to conduct performance load test for the applications. This article provides quick guide to configure Load runner to generate load to your application. Load runner has many features and it not possible to cover all of them in one document. But, this article can get you quick start with the load testing your application. In the first part of the article I will be discussion how to record vuser script in the Mercury Load Runner.



Architecture

LoadRunner simulates the client software, such as internet browser sending requests using the HTTP protocol to the web servers. Virtual client requests are generated by "Load Generators" in order to create a load on various servers under test. These load generators are controlled by Mercury’s controller components. A controller runs and controls the load test based on its scenario configuration (Run Time settings) set by test professional. Controller also invokes compiled users scripts recorded with desired user actions.At the end of each run, the Controller combines its monitoring logs with logs obtained from load generators. An analysis component of the Mercury provides the run result report in graphical manner in MS Word or HTML format.Load runner contains mainly following three components.Load runner contains mainly following components.


Load Runner Vu Gen: VuGen (Virtual User Generator), enables you to develop Vuser scripts for a variety of application types and communication protocols.


Load Runner Controller: The LoadRunner Controller allows you to easily and effectively control all the Vusers from a single point of control


Load Runner Analysis: LoadRunner Analysis provides graphs and reports to help you analyze the performance of your system. These graphs and reports summarize the scenario execution.



Generating Load Runner vuser script for Performance Test

As I have mentioned above Controller plays vital role in managing all the LR components. To run load against the application LR script should be recorded. In this section of the article I will provide step by step activities and configuration needs to be done to run the load test.

We will be practicing how to prepare for Performance test of a web application using HTTP protocol.

Recording a Script using VU GenOpen LoadRunner Start up Screen and click Create/Edit Scripts


Once VU Gen is open click File --> New. Select “All Protocol” from the Category dropdown menu to see all the protocols available. Select Web (HTTP/HTML) and click OK.





You will be seeing Introduction screen as below. Click “Start Record” in the task bar





Provide you application information such Application type, Program to record, your application URL, working directory and the action you want to call it as. You need to select appropriate action for the traction you are recording. For example login transaction in the application you want to record only once so it should go into “vuser_init”. Your repetitive transaction should go in “Action” and the transactions like logoff should go in “vuser_end”. This will help you categorizing you load transactions and mimic the actual user behavior. “Record into Action” option can be changed during actual recording or can be modified in the generated script. Click OK to start recording.



When recording start you will be seeing the recording toolbar along with the browser where you interact with application and your activities will be recorded and script will be generated.

During recording you can also provide different names to your activity as transactions. And the provided names will be appeared in the generated script as well as in the analysis report of the performance test.


Once you are done with the activity to be recorded for the performance test. You can stop the recording by clicking Stop button on the recording toolbar. As soon as recording is stopped VU Gen start creating scripts for the activity you recorded. You can also modify the script if you know load runner c library functions. Simple things can me modified such as adding think time between transactions, adding transactions, providing dynamic values to the parameters from data pool etc.



You can test run the generated vuser script by clicking play button in the tool bar to verify if the script is working fine. Replay log in bottom pane provides debug information for the verification. Once you are done with the changes and test you can save the script. This script will be used by controller to run the virtual user load. I will discuss controller scenario creation in the Part II of this article.






-->

Mercury Load Runner Controller and Analysis (Part II)
Mercury Load Runner Controller Overview
As I have discussed the role of controller in brief in the Part I of this article, we will be exploring how to create controller scenario for the performance test. There are certain things you need to decide such as, what type of load you want to generate, and what would be your browser setting. A controller also manages load generators machines which actually generates load to the application. During the test controller displays live graphs to monitor parameters such as response time, hits per second, Throughput etc.
Let’s get started creating the Load runner scenario and configuration.
Creating and Configuring Controller scenario

-->
Like any other software window Controller has Title bar, Menu bar, Tool bar, Design Tab, Run Tab, and Status bar. You can open controller window by clicking Program Files --> Mercury LoadRunner --> Applications --> Controller



-->
To manage Load Generators click “Generators” button on the right side of the window. Click add to add load generator machines to the controller. Click connect to activate the load generators. Remember load generator machine must have Load Runner agent running to generate load to your application.



-->
Once generators are active click “Close”.
Add the script you have recorded for your application to the controller. You need to create group to add the script for which you can configure different scheduling and run time settings. You can create multiple groups and add different scripts to them. Enter the quantity of virtual users you want each group to load in the quantity column and select the load generator.



-->
Highlight the selected group and click “Run-time Setting” button to set the run time setting for the group with scripts.
Select the number of iterations as you need for the selected group, Think time (you may selection option to pick think time from the script or set new here), Browser emulations, Content Check etc.






-->Click on the “Edit Schedule” button to schedule time duration of the test, ramp up and ramp down time. You can schedule your load test either by scenario or by group. In case by scenario all groups will be loaded and run with the same configuration. But, in case of schedule by group you have flexibility to have different strategy for each group. You can also schedule your scenario to kick off at scheduled time and date. You can also opt initialize all the users before they actually start performing the intended load activities (such as log in all users before clicking anywhere in the application). This dialog box also provides the graphical load preview of your settings.









-->Once you are done the scheduling, you can move to the “Run” tab to actually start the performance test and monitor some online performance statistics. To Start the Load test you need to click “Start Scenario” and controller will start running the configuration you have set for the scenario. You can select the graphs from the available graphs pane to watch during the load test. And transaction statistics are available at runtime in the bottom pane of the controller.







-->
Analysis Report
When you run a scenario, data is stored in a result file with .lrr extension. Analysis is the utility that processes the collected result information and generates graphs and reports.
You can open Analysis through as an independent application or directly from the Controller. To open Analysis as an independent application, choose Analysis from the LoadRunner Program group.

Collating Results
When you run a scenario, by default all Vuser information is stored locally on each Vuser host. After scenario execution the results are automatically collated or consolidated—results from all of the hosts are transferred to the results directory. You disable automatic collation by choosing Results >
Auto Collate Results from the Controller window, to clear the check mark adjacent to the option.








-->You can generate the report in MS word format by clicking Report in the menu bar.


Good Luck!


-->

-->
-->
-->