Wednesday, March 4, 2015

LR_Controller

LoadRunner Controller                                                             S.S.Reddy

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.
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.
Start the Controller
To begin developing a scenario, you open the LoadRunner Controller.
  1. Open the HP LoadRunner Controller.
Select Start > All Programs > HP Software > HP LoadRunner > Controller, or click the Controller shortcut icon on your desktop.
The HP LoadRunner Controller opens and displays the New Scenario dialog box.
  1. 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.
  1. Add a Vuser script to the load test.
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. use the sample script.
    • In the New Scenario dialog box, click the Browse button.
    • Locate and select basic_script in the <LoadRunner Installation>\Tutorial folder. Click Open.
    • Click the Add button to move basic_script from the Available Scripts pane to the Scripts in Scenario pane of the New Scenario dialog box.
    • Click OK. The LoadRunner Controller opens and displays the Design tab of your new scenario.
Note that the control for the Design tab is in the lower left corner of the Controller.
The 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
  1. Service Level Agreement pane
  1. Scenario Schedule pane
  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.
  1. 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.
  1. 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.
Modifying the script details
Modify the script details as follows:
  1. Check to see that basic_script appears in the Group Name column of the Scenario Groups pane.
  1. Change the Group Name.
    1. In the Scenario Groups pane, select basic_script and click the Details button. The Group Information dialog box opens.
    1. In the Group Name box, enter a more meaningful name, for example travel_agent.
    1. Click OK. The new name is displayed in the Scenario Groups pane of the Design tab.
Generating a load on the system
After added your Vuser scripts to the scenario, you configure the load generators, the computers that generate the load on the system.
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.
Adding load generators to the scenario, and testing the load generator connections.
  1. 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.
Note that in a typical operational system, you would have several load generators, each hosting multiple Vusers.
  1. 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.
    1. Click Close.
Emulatting 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.
      1. Select Initialize all Vusers simultaneously.
      1. Click OK.
    1. 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 Schedulegrid. The Edit Action dialog box opens displaying the Start Vusers action.
      1. In the Start X Vusers box, enter 8, and select the second option— 2 Vusers every 00:00:30 (30 seconds).
      1. Click OK.
    1. 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 run-time 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.
      1. 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 that if the Legend is displayed on top of the diamond, click the Hide Legend button on the Interactive Schedule Graph toolbar to show the diamond.
      1. 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.
    1. 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.
      1. Select the second option and enter the following values—2 Vusers every 00:00:30 (30 seconds).
      1. Click OK.
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.
More about LoadRunner’s run-time settings, and you will enable Think Time and Logging.
  1. Open the run-time settings.
    1. In the Controller, click the Design tab.
    1. In the Scenario Groups pane, select the travel_agents group.
    1. Click the Run-Time Settings button on the Scenario Groups toolbar. The Run-Time Settings dialog box opens.
The run-time 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 run-time 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.
  1. Enable think time.
    1. In the Run-Time Settings dialog box, click General > Think Time.
    1. Select Replay think time, and select Use random percentage of recorded think time.
    1. 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).
  1. Enable logging.
    1. In the Run-Time Settings dialog box, click General > Log.
    1. Select Enable logging.
    1. Under Log options, select Always send messages.
    1. Click Extended log, and select Data returned by server.
    1. Click OK to close the Run-Time Settings dialog box.
    1. Save the scenario.
Monitoring the system under load
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.
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.
    1. Right-click inside the Windows Resources graph and select Add Measurements. The Windows Resources dialog box opens.
  1. 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.
    1. 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.)
    1. From the Platform list, select the platform on which the machine runs.
    1. Click OK.
The default Windows Resources measurements are listed under the Resource Measurements on <server machine>.
  1. Activate the monitor.
Click OK in the Windows Resources dialog box to close the dialog box and activate the monitor.



Reference: loadmeter.bg/lr                    
Note: Some of the articles are grab from various Websites / Blogs.

No comments:

Post a Comment