In the previous lesson, you used VuGen to validate your Vuser script. In this lesson, you will evaluate your system under the load of multiple Vusers. You will emulate the actions of ten travel agents concurrently using the flight reservation system, and observe the behavior of the system under the load of these users. To design and run this test, you use the LoadRunner Controller.
In this lesson, the objective is to create a scenario that emulates the behavior of ten travel agents simultaneously logging on, searching flights, purchasing flights, checking itineraries, and logging off.
In this lesson you will cover the following topics:
- Introducing the LoadRunner Controller
- How do I start the Controller?
- Controller at a Glance
- How do I modify the script details?
- How do I generate a load on the system?
- How do I emulate real load behavior?
- How do I emulate different types of users?
- How do I monitor the system under load?
Load testing means testing your system under typical working conditions. For example, you may test the system while many travel agents simultaneously reserve flights on the same flight reservation system.
You design the test to emulate real-life situations. To do this, you need to be able to generate a load on an application and schedule when the load is applied (because users do not log on and off the system at precisely the same time). You also need to emulate different types of user activity and behavior. For example, some users may use Firefox to access the system, whereas other users use Internet Explorer. Users may also employ different network connections to access the system, such as modem, DSL, or cable. You create and save these settings in a scenario.
Controller provides you with all the tools you need to help you build and run tests to accurately emulate your working environment.
To begin developing a scenario, you open the LoadRunner Controller.
Open the LoadRunner Controller.
On the LoadRunner machine, click the Controller shortcut icon on your desktop.
The LoadRunner Controller opens and displays the New Scenario dialog box.
Select a scenario type.
There are two scenario types:
A Manual Scenario gives you control over the number of running Vusers and the times at which they run, and lets you test how many Vusers your application can run simultaneously. You can use Percentage Mode to distribute the total number of Vusers between the scripts based on a percentage specified by your business analyst. The Percentage Mode check box is selected by default the first time you start LoadRunner following installation. If it is selected, clear it.
A Goal-Oriented Scenario is used to determine if your system can achieve a particular goal. You determine the goal based on, for example, a specified transaction response time or number of hits/transactions per second, and LoadRunner automatically builds a scenario for you based on these goals.
Click Manual Scenario.
Note: The Use the Percentage Mode... check box should not be selected.
Add a Vuser script to the load test.
In this tutorial, you will use only one Vuser script to model a single group of users performing identical actions. To more accurately emulate a real-world scenario with more versatile user profiles, you would create a number of different Vuser groups, with each group running several scripts with different user settings.
The script that you previously recorded in VuGen contains the business processes that you want to test. They include logging on, searching for a flight, buying a ticket, checking the flight itinerary, and then logging off the site. You will add a similar script to the scenario, and configure the scenario to emulate eight travel agents simultaneously performing these actions on the flight reservation system. You will add two more Vusers during the test.
For this purpose, a sample script is provided that is similar to the one you created. We recommend that you use the sample script.
If basic_script is already in the Available Scripts pane, select it and click the Add button to move the script to the Scripts in Scenario pane.
If basic_script is not in the Available Scripts pane, click the Browse button. Locate basic_script in the <LoadRunner root>\tutorial folder. Click Open. Click the Add button to move the script to the Scripts in Scenario pane.
Click OK. The LoadRunner Controller opens and displays the Design tab of your new scenario.
Note: The control for the Design tab is in the lower left corner of the Controller.
The Design tab of the Controller is the main interface for designing your load test. The Design tab is divided into three panes:
- Scenario Groups pane. You configure the Vuser groups in the Scenario Scripts pane. You create different groups to represent typical users of your system and specify the number of Vusers that will run, and the machine that they will run on.
- Service Level Agreement pane. When you design a load test scenario, you can define goals or SLAs (Service Level Agreements) for the performance metrics. When you run the scenario, LoadRunner gathers and stores performance-related data. When you analyze the run, Analysis compares this data against the SLAs and determines SLA statuses for the defined measurements.
- Scenario Schedule pane. In the Scenario Schedule pane, you set the load behavior to accurately portray real-world user behavior. You define actions according to which the Vusers will run, the rates at which load is applied to the application, the load test duration, and how the load is terminated.
You modify the script details as follows:
Check to see that basic_script appears in the Group Name column of the Scenario Groups pane.
Change the Group Name.
After you have added your Vuser scripts to the scenario, you configure the load generators, the computers that generate the load on the system.
Tip: Definition: A load generator is a computer that runs multiple Vusers in order to generate a load on the system. You can use a number of load generators, each generator hosting multiple Vusers.
In this section, you will learn about adding load generators to the scenario, and testing the load generator connections.
Add a load generator
Click the Load Generators button on the Controller toolbar. The Load Generators dialog box opens.
The Load Generators dialog box enables you to view and configure the load generators that are defined in the scenario. The Load Generators dialog box shows details for the load generator called localhost. The status of the localhost load generator is Down. This indicates that the Controller is not connected to the localhost load generator.
In this tutorial, you will use your local computer as the load generator.
Note: In a typical operational system, you would have several load generators, each hosting multiple Vusers.
Test the load generator connection
When you run a scenario, the Controller connects to the load generators automatically. However, you can test the connections before trying to run the scenario.
In the Load Generators dialog box, select localhost and click Connect.
The Controller attempts to connect to the load generator machine. When a connection has been made, the Status of the load generator changes from Down to Ready.
- Click Close.
After you have added your load generators, you are ready to configure load behavior.
Typical users do not log on and off the system at precisely the same time. LoadRunner allows users to gradually log on to and off the system. It also lets you determine the duration of the scenario, and the way in which the scenario terminates. The scenario that you will configure below will be relatively simple. However, when designing a scenario that more accurately reflects a real life scenario, you can define more true-to-life Vuser activity.
You configure the load behavior for a manual scenario in the Scenario Schedule pane of the Controller. The Scenario Schedule pane is divided into three sections: the Schedule Definition area, the Actions grid, and the Schedule graph.
You will now change the default load settings and configure a scenario schedule.
Select schedule type and run mode.
In the Scenario Schedule pane, make sure that Schedule by: Scenario and Run Mode: Real-world schedule are selected.
Set the scheduled action definitions.
You can set the Start Vusers, Duration, and Stop Vusers actions for the scenario schedules from the Global Schedule grid.
You will now set the definitions so that the Global Schedule grid will look as below.
Set up the Vuser Initialization.
Initialization means preparing the Vusers and the load generators for a load test run by running the vuser_init action in the script. Depending on your system configuration, initializing Vusers before they start running may provide more realistic results.
Specify a gradual start for the Vusers
Starting Vusers at intervals allows you to examine the gradual increase of Vuser load on the application under test over time, and helps you pinpoint exactly when the system response time slows down.
Schedule the duration.
You specify a duration to make sure that the Vusers continue performing the schedule action for a specific period so you can measure continuous load on the server. If you set a duration, the script will run for as many iterations as necessary during that period, disregarding the number of iterations set in the script’s runtime settings.
- Double-click Duration in the Global Schedule grid. The Edit Action dialog box opens displaying the Duration action.
- Select the Run for option, and enter 00:10:00 (HH:MM:SS) to set the scenario to run for 10 minutes.
- Click OK.
Schedule a gradual closure.
Gradually stopping Vusers is recommended to help detect memory leaks and check system recovery, after the application has reached a threshold.
Now that you have configured a load schedule, you will specify how the Vusers will behave during the test.
When emulating a real user, you need to consider the user’s actual behavior. Behavior refers to the time that a user takes to pause between actions, the number of times a user repeats an action, and so on.
In this section, you will learn more about LoadRunner’s runtime settings, and you will enable Think Time and Logging.
Open the runtime settings.
- In the Controller, click the Design tab.
- In the Scenario Groups pane, select the travel_agents group.
Click the Runtime Settings button on the Scenario Groups toolbar. The Runtime Settings dialog box opens.
The runtime settings let you emulate different kinds of user activity and behavior. They include:
Run Logic The number of times a Vuser repeats a set of actions. Pacing The time to wait before repeating the action. Log The level of information that you want to gather during the test. The first time you run a scenario, it is recommended to generate log messages to make sure that you have debugging information in case the first run fails. Think Time The time the user stops to think between steps. Since users interact with the application according to their experience level and objectives, more technically proficient users may work more quickly than new users. Vusers can be made to emulate their real-world counterparts more accurately during a load test by enabling think time. Speed Simulation Users using different network connections such as modem, DSL, and cable. Browser Emulation Users using different browsers to see their application’s performance. Content Check
For automatically detecting user-defined errors.
Suppose that your application sends a custom page when an error occurs. This custom page always contains the words ASP Error. You need to search all of the pages returned by the server and see if the text ASP Error appears.
You can set up LoadRunner to automatically look for this text during the test run, using the Content Check runtime settings. LoadRunner searches for the text and generates an error if it is detected. During the scenario run, you can identify the content check errors.
Enable think time.
- In the Runtime Settings dialog box, click General > Think Time.
- Select Replay think time, and select Use random percentage of recorded think time.
Specify a minimum of 50% and a maximum of 150%.
The above specifications use a random percentage of the recorded think time to emulate users with a varying range of proficiency. For example, if the recorded think time for selecting a flight was 4 seconds, the random think time could be anything between 2-6 seconds (50% to 150% of 4).
In the Runtime Settings dialog box, click General > Log.
Select Enable logging.
Under Log options, select Always send messages.
Click Extended log, and select Data returned by server.
Note: After the initial debugging run, extended logging is not recommended for a load test. It is enabled only for the purposes of this tutorial to provide information for the Vuser Output log.
Save the scenario.
Now that you have defined how your Vusers will behave during the test, you are ready to set up your monitors.
While generating a load on an application, you want to see how the application performs in real time and where potential bottlenecks exist. You use LoadRunner’s suite of integrated monitors to measure the performance of every single tier, server, and component of the system during the load test. LoadRunner includes monitors for a variety of major backend system components including Web, application, database, and ERP/CRM servers.
For instance, you can select a Web Server Resources monitor according to the type of Web server that is running. You can purchase a license for the relevant monitor, for example IIS, and use that monitor to pinpoint problems reflected in the IIS resources.
In this section, you will learn how to add and configure the Windows Resources monitor. You can use this monitor to determine the impact of load on your CPU, disk, and memory resources.
Select the Windows Resources Monitor.
Click the Run tab at the bottom of the Controller.
The Windows Resources graph is one of four default graphs that are displayed in the graph viewing area. You will learn how to open other graphs in the next lesson.
Right-click inside the Windows Resources graph and select Add Measurements. The Windows Resources dialog box opens.
Select the monitored server.
In the Monitored Server Machines section of the Windows Resources dialog box, click Add. The Add Machine dialog box opens.
- In the Name box, type localhost. (If your load generator was running off a different machine you would type the server name or IP address of that machine.)
- From the Platform list, select the platform on which the machine runs.
The default Windows Resources measurements are listed under the Resource Measurements on <server machine>.
Activate the monitor.
Click OK in the Windows Resources dialog box to close the dialog box and activate the monitor.