Lesson 5: Creating a Load Testing Scenario

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.

Scenario Objectives

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

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.

Back to top

How do I start the Controller?

To begin developing a scenario, you open the LoadRunner Controller.

  1. Open the HP LoadRunner Controller.

    On the LoadRunner machine, click the Controller shortcut icon on your desktop.

    The HP LoadRunner Controller opens and displays the New Scenario dialog box.

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

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

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

    2. If basic_script is not in the Available Scripts pane, click the Browse button. Locate basic_script in the <LoadRunner Installation>\Tutorial folder. Click Open. Click the Add button to move the script to the Scripts in Scenario pane.

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

Back to top

Controller at a Glance

The Design tab of the Controller is the main interface for designing your load test. The Design tab is divided into three panes:

  1. 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.
  2. 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.
  3. 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

.

Back to top

How do I modify the script details?

You modify the script details as follows:

  1. Check to see that basic_script appears in the Group Name column of the Scenario Groups pane.

  2. Change the Group Name.

    1. In the Scenario Groups pane, select basic_script and click the Details button . The Group Information dialog box opens.

    2. In the Group Name box, enter a more meaningful name, for example travel_agent.

    3. Click OK. The new name is displayed in the Scenario Groups pane of the Design tab.

Back to top

How do I generate a load on the system?

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.

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

  2. Click Close.

Back to top

How do I emulate real load behavior?

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 Interactive Schedule graph.

You will now change the default load settings and configure a scenario schedule.

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

  1. Set the scheduled action definitions.

    You can set the Start Vusers, Duration, and Stop Vusers actions for the scenario schedules from either the Global Schedule grid, or by manipulating the Interactive Schedule graph. When you set the definitions from the graph, the Global Schedule grid properties adjust accordingly.

    You will now set the definitions so that the Global Schedule grid will look as below.

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

      1. Double-click Initialize in the Global Schedule grid. The Edit Action dialog box opens displaying the Initialize action.

      2. Select Initialize all Vusers simultaneously.
      3. Click OK.
    2. 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.

      1. Double-click Start Vusers in the Global Schedule grid. The Edit Action dialog box opens displaying the Start Vusers action.

      2. In the Start X Vusers box, enter 8, and select the second option— 2 Vusers every 00:00:30 (30 seconds).

      3. Click OK.
    3. 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.

      1. Make sure that the Interactive Schedule Graph is in Edit mode by clicking the Edit Mode button on the Interactive Schedule Graph toolbar.
      2. In the Interactive Schedule Graph, click the horizontal line which represents Duration. The line is highlighted and a dot and a diamond are displayed at its endpoints.

        Note: The legend is displayed on top of the diamond, click the Hide Legend button on the Interactive Schedule Graph toolbar to show the diamond.n

      3. Drag the diamond shaped endpoint to the right until the time in brackets reads 00:11:30. You have just set the Vusers to run for a period of 10 minutes.
    4. 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.

      1. Double-click Stop Vusers in the Global Schedule grid. The Edit Action dialog box opens displaying the Stop Vusers action.

      2. Select the second option and enter the following values—2 Vusers every 00:00:30 (30 seconds).
      3. Click OK.

Back to top

How do I emulate different types of users?

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.

  1. Open the runtime settings.
    1. In the Controller, click the Design tab.
    2. In the Scenario Groups pane, select the travel_agents group.
    3. 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.

  2. Enable think time.
    1. In the Runtime Settings dialog box, click General > Think Time.
    2. Select Replay think time, and select Use random percentage of recorded think time.
    3. 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).

  3. Enable logging.
    1. In the Runtime Settings dialog box, click General > Log.

    2. Select Enable logging.
    3. Under Log options, select Always send messages.
    4. 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.

    5. Save the scenario.

Back to top

How do I monitor the system under load?

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.

  1. Select the Windows Resources Monitor.
    1. 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.

    2. Right-click inside the Windows Resources graph and select Add Measurements. The Windows Resources dialog box opens.

  2. Select the monitored server.
    1. In the Monitored Server Machines section of the Windows Resources dialog box, click Add. The Add Machine dialog box opens.

    2. 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.)
    3. From the Platform list, select the platform on which the machine runs.
    4. Click OK.

      The default Windows Resources measurements are listed under the Resource Measurements on <server machine>.

  3. Activate the monitor.

    Click OK in the Windows Resources dialog box to close the dialog box and activate the monitor.

Back to top

Next steps: