Saturday 11 May 2013

LoadRunner Tutorial



7
Creating a Load Testing Scenario
In the previous lesson you successfully validated your test in the Virtual
User Generator.In this lesson, you will test your application under load. You
will emulate the actions of ten travel agents concurrently using the flight
reservation system, and observe the behavior of the system under load. To
design and run this test, you use the LoadRunner Controller.
In this lesson you will cover the following topics:
Introducing the LoadRunner Controller
What mixture of users should be part of the load test?
The Controller Window at a Glance
How do I generate a heavy load?
How do I emulate real load behavior?
How do I emulate different types of users?
How do I monitor the system under load?

Introducing the LoadRunner Controller
Load testing means testing your application under typical working
conditions, for example, many travel agents reserving flights on the same
flight reservation system at the same time.
You design the test to emulate real-life situations. To do this, you need to be
able to generate heavy load on an application and schedule when the load is
applied (since users do not log on and off the system at precisely the same
time). You also need to emulate different kinds of user activity and behavior.
For example, some users might be using Netscape instead of Internet
Explorer to see the application’s performance, and using different network
connections such as modem, DSL, or cable. You create and save these
settings in a scenario.
The Controller provides you with all the tools you need to help you build
and run tests to accurately emulate your working environment.
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 the system.
Starting the Controller
To begin creating a scenario, you open the Controller and create a new
scenario.
1 Open HP LoadRunner.
Choose Start > Programs >LoadRunner>LoadRunner. The HP LoadRunner
Launcher window opens.
What mixture of users should be part of the load test?
In this tutorial, you will use just one Vuser script to model a single group of
users performing identical actions. To emulate a real scenario with a more
varied mix of user profiles, you would create different groups 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 users during the test
itself.
1 Add a script to the load test.
For the purpose of this tutorial, a script is provided that is similar to the one
you created. We recommend that you use the sample script.
Click the Browse button, and navigate to basic_scriptin the <LoadRunner
Installation>\Tutorial directory.
The script is displayed in the Available Scripts section and in the Scripts in
Scenario section.
Click OK. The LoadRunner Controller opens your scenario in the Design
tab.
2 Begin designing the load test scenario.
Check to see that the basic_scriptappears in the Group Name column of the
Scenario Groups window.
The Controller Window at a Glance
The Controller window’s Design tab contains three primary sections:
Scenario Schedule
Scenario Groups
Service Level Agreement

Scenario Schedule: In the Scenario Schedule section, you set the load
behavior to accurately portray user behavior. You determine the rate at
which load is applied to the application, the load test duration, and how the
load is stopped.
Design
Tab
Scenario Groups: You configure the Vuser groups in the Scenario Groups
section. You create different groups to represent typical users of your system.
You define the actions that they will run, the number of Vusers that will
run, and the machine that they will run on.
Service Level Agreement: When you design a load test scenario, you can
define goals or Service Level Agreements (SLAs) 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.
How do I generate a heavy load?
After you have added your scripts and defined the number of Vusers that
you want to run in the scenario, you can configure the load generator
machines.
Load generators are the machines that create load on the application by
runningVusers. You can use a number of load generator machines, each
hosting many virtual users. In this section, you will learn about adding load
generators to the scenario and testing the load generator connection.
1 Add a load generator.
Click the Load Generators button. The Load Generators dialog box opens,
showing details for the localhostload generator machine.

In this tutorial, you will use your local computer as the load generator
(included in the scenario by default). The status of the localhostload
generator is Down. This indicates that the Controller is not connected to the
load generator.
Note: In a typical production system, you would have a few load generator
machines, each hosting many Vusers. You would add additional machines
by clicking the Add button in the Load Generators dialog box, and entering
the machine name and platform type in the Add New Load Generator dialog
box.
2 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 a
scenario.
Select the localhostload generator and click Connect.
The Controller attempts to connect to the load generator machine. When a
connection has been made, the status changes from Down to Ready.
Click Close.
How do I emulate real load behavior?
After you have added your load generator machines, 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 load test, and the way in which the
scenario is stopped.
You configure the load behavior for a manual scenario in the Scenario
Schedule area of the Controller window. The Scenario Schedule section is
divided into two sections, the Schedule Definition pane and the Schedule
Actions grid.
How do I emulate different types of users?
Now that you have configured a load schedule, you will specify how your
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 he repeats an action, and so on.
In this section, you will learn more about LoadRunner’s run-time settings,
and you will enable think time and logging.
1 Open the Run-Time settings.
In the Design tab, select the script and click the Run-Time Settings button.
The Run-Time settings are displayed.

The Run-Time settings let you emulate different kinds of user activity and
behavior. They include:
Run Logic: the number of times a user repeats a set of actions
Pacing: the time to wait before repeating the action
Note: After the initial debugging run, extended logging is not recommended
for a load test. It is only enabled for the purposes of this tutorial to provide
information for the Vuser Output log.
Click OK to close the Run-Time settings.

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 creating heavy load on an application, you want to see how the
application performs in real time and where potential bottlenecks exist. You
useLoadRunner’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 this 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.
2 Select the monitored server.
In the Monitored Server Machines section of the Windows Resources dialog
box, click Add. The Add Machine dialog box opens.
 
Type localhostin the Name box.(If your load generator was running off a
different machine you would type the server name or IP address of that
machine.) In the Platform box, enter the platform on which the machine
runs. Click OK.
The default Windows Resources measurements are displayed in the
Resource Measurements on <server machine>pane.

3 Activate the monitor.
Click OK in the Windows Resources dialog box to activate the monitor.

No comments:

Post a Comment