Opensta from entry to entry

Source: Internet
Author: User
ArticleDirectory
    • 1. NT Performance Configuration
    • 2. Basic Introduction to script
    • 3. parameterization of script variables
    • 4. DOM object implementation Association
    • 5. How to add a Task Group
    • 6. Description of parameters of Task Group
    • 7. Brief Introduction to monitoring and results
    • 8. Set the load generator
    • 9. Summary

Opensta is a distributed software testing framework based on CORBA. With opensta, testers can simulate a large number of virtual users. Opensta results include the virtual user response time, web server resource usage, database server usage, and precise measurement of the load test results. Official documentation: opensta tutorial

Summary

Content

This article describes several important parts of opensta in detail. For details about other parts, see the official documentation. This article focuses on:

    1. COLLECTOR:

      1. NT Performance Configuration
    2. Script:
      1. Script Introduction
      2. Parameterization of script variables
      3. DOM object implementation Association
    3. Test
      1. How to add a Task Group
      2. Parameter options of Task Group
      3. Monitoring and results
    4. Name Server
      1. Set the load generator
1. NT Performance Configuration

NT Performance calls the perfmon tool provided by the operating system. We will not discuss how to set and add windows performance monitoring here.

2. Basic Introduction to script

First of all, the opensta script uses its proprietary script control language, which is complex and difficult to use. Therefore, my position on opensta is: the script is mainly recorded, a small part of the modification, supplemented by parameter settings. Now we can create a BASIC script to see what it is like, for example, accessing a static page (the simplest page, with several characters output). The recording script is as follows:

We only recorded a simple script for accessing a static page, and generated so manyCode! Don't panic. Let's take a closer look. In fact, we break down the code and divide the script into three parts: environment, definitions, and code. I also learned the general content and functions of each part. Therefore, if we leave aside other parts and only look at the primary get URI statement of the Code part, is it much easier ?!

After the primary get URI statement, we can see the "On 1" code, and there is a "disconnect from 1" Statement in the last few lines of the script. Here, "On 1" is used to indicate TCP connections, and "disconnect from 1" is used to disable TCP connections. This is all recorded by opensta based on the actual situation under the HTTP protocol.

After a general understanding of the script structure, let's take a look at how to define variables in definitions and use our variables in code.

3. parameterization of script variables

3.1 create a variable

Use the script modeler menu variables-create to create variables, such:

    1. Name-- Variable name

    2. ScopeVariable range, a very important attribute !! It has the following scopes:

      • Local

        • When the range of a variable is set to local, the virtual user can only use this variable in his or her current script, rather than other users or other scripts. It may not be easy to understand at the beginning. Let's use the following figure to express the relationship between virtual users, scripts, and scope:

      • Script
        • When the range of variables is set to script, all virtual users share the variables in the same script at runtime. For example, if four virtual users run script a together and assume that script a contains variable B in the script range, the four virtual users share variable B, if someone modifies variable B, it will affect others. For example:

      • Thread
        • In opensta, each virtual user is a separate thread. After the single variable range is set to thread, the variable is shared within the thread of a single virtual user, it is amazing that it is defined in a script but can share the same variable across the script. Therefore, if you want to set the thread range to allow multiple scripts to share the same variable, you must define it in each script. We usually define this variable in the global_variables.inc file. This is a global variable file, and each of our scripts will reference it in, such:

          Include "Global_variables.inc"

          The range of variables in the thread range is as follows:

      • Global
        • Variables that are set to global have the largest possible range, that is, variables are shared among all virtual users and all scripts. Similarly, variables must be defined in each script or in global_variables.inc. For example:

    3. Value-- Set the source of the value. It can be a variable value, a Value List, a file, or a database.

    4. Order-- The order of variable values, which can be sequential or random ). Note: when the data is obtained, the data is retrieved from the beginning.

    5. Type-- Variable type, which can be a string (character) or a number (integer ).

3.2 use Defined variables

Suppose we have created two variables, username and password, in the previous step. scope is defined as script, and then two local variables, my_username and my_password, are created. The definition in definitions is as follows:

  • Character * 512 Username ( "Phillip" , "Allan" , "David" , "Robert" , "Donna" ), Script

    Character*512 Password ( "Pillihp", "Nalla", "Divad", "Trebor", "Annod" ), Script

    Character*512 My_username, Local

    Character*512 My_password, Local

To allow all users to use the same variable in the same script and solve the concurrency problem, we must use mutexlocking before using the variable ). As follows:

    • acquire mutex " login "

      next username

      next password

      set my_username = username

      set my_password = password

      release mutex " login "

Process: first, lock (acquire mutex) and obtain the name login. Then, use the next statement to obtain the next data of the username and password variables, then, use the set statement to assign the retrieved value to the local variables my_username and my_password, and then release the lock (release mutex ).

With the above four variables of different ranges, we believe that it is quite simple and convenient to implement different types of parameterization.

4. DOM object implementation Association

Dom is the abbreviation of Document Object Model. Dom is an interface unrelated to browsers, platforms, and languages, allowing you to access other standard components on the page. With Dom, we can dynamically retrieve the returned HTML or XML, and conveniently retrieve the content of the corresponding node for inspection or other use. During recording, opensta records the information in a file suffixed with. All, positions the cursor at the primary post URI or primary get Uri, and click the yellow right arrow in the toolbar,

Now we need to Dynamically Retrieve the page's return value: "You are great !", Select the HTML tree in the DOM tab and find "You are great !", Select, right-click "Address ",

In the pop-up dialog box, enter the variable name, for example, returntext. After confirming, the following content is added to the Code:

    • Load Response_info Body On 1 &

      Into Returntext &

      With "HTML (0)/body (0)/font (0): Text :( 0 )"

Then we can directly use the returntext variable. We can use the report function to output the returntext to check whether it is correct.

    • Report Returntext

Each time you access the page, the cookie value will be different. opensta automatically processes the things that need to be dynamically obtained for us. The processing method is the same as the returntext.

5. How to add a Task Group

Adding a task group to Commander is abnormal. First, right-click tests to create a test, drag the script or collector to be run to the taskx (, 3...) of the task group in the directory tree on the left ...) column. You can see that a task group can have multiple tasks. Note the following:

    • Collector and script cannot be placed in the same taks group.
    • When a Task Group has multiple tasks, the execution sequence is performed by task number. For example, if there are four tasks, the execution sequence is task1 → task2 → task3 → task4.
    • If multiple users execute multiple tasks, a user executes Task 1 first, instead of waiting for other users to finish Task 1, but directly executes Task 2. That is, the user does not set and is executed independently.
6. Description of parameters of Task Group

First, let's take a look at the columns of the task group:

  • Task GroupThe column is the name and description of the task group.

  • StartYou can set the start Task Group in the column, which can be: immediately and scheduled) and how long after the timer starts from now (Delay ). The conditions for ending a task group are divided into: On completion, manual control (manually ), after fixed time ).

  • StatusThe column indicates the status of the current task group. The status before execution is "enabled". After execution, status such as "running" and "failed" appears.

  • HostThe column is the host name or IP address of the Server Load balancer. You can set the Running Load of other remote machines.

  • VUSColumns are related to virtual user settings. Some content on the interface is not fully displayed, so use Spy ++ to retrieve the complete content. See:

    • Total number of virtual users for this task group -- specify the total number of virtual users of the task group.
    • Number of virtual users for timer results -- specifies the number of virtual users who need to perform timer timing statistics. During execution, operations such as counting the transaction execution time will also cause a certain amount of consumption. Therefore, you can specify that only some virtual users collect their own time statistics, which is similar to the idea of "sampling statistics.
    • Number of virtual users for HTTP results-specify the number of virtual users for HTTP results, which is similar to the preceding meaning. sampling statistics.
    • Generate timers for each page -- perform time statistics for each page in the script. I don't understand this. It doesn't seem helpful to try various situations. Let me know if you know ~ ,
    • Introduce virtual users in batches -- sets whether to divide virtual users into several batches for execution. If selected, a batch start options will appear on the right.
    • Interval between batches -- set the execution interval for each batch of users
    • Number of virtual users per batch -- set the number of users in each batch
    • Batch ramp up time (seconds) -- set the execution time for each batch
    • Execution by batch is a strange rule, for exampleThe total number of virtual users is set to 20, and the interval for each batch is set to 2 seconds. The number of users in each batch is 5, and the running time for each batch is 10 seconds., The running status is as follows:

      •  

        However, how are the five virtual users in the same batch executed? Is it executed concurrently within 10 seconds? Multiple times? Or in 10 seconds? After testing, we found that the five virtual users in the same batch are executed in order, because the number of users in each batch is 5 and the number of running times in each batch is 10 seconds. Therefore, each user needs to execute 10/5 = 2 seconds in an average order. In 2 seconds, the virtual user only runs once, and then the next user starts to execute 2 seconds later. The execution of users in the same batch is as follows:

  • TaskThe column is the basic information of the task for setting the column of the current day. Some words are not complete on the interface.

    •  

    • Task termination: the end of a task can be divided into two types: On completion after a specified number of times of cyclic execution, and after fixed time after a specified time of cyclic execution ). When on completion is selected, enter the number of cycles in the text box below. When after fixed time is selected, enter the time for loop execution in the text box below.
    • Delay between each iteration -- set the interval between two adjacent iterations. There are two types: fixed time (fixed delay) and variable time (variable delay ). When fixed delay is selected, enter a fixed interval (Delay) in the text box below. When variable delay is selected, enter the minimum value of the interval range (minimum) and maximum ).
7. Brief Introduction to monitoring and results
    • Monitoring is only available during test run, which is abnormal and waste-consuming.
    • The results part is very simple. It seems that there is too little information to be collected, and charts cannot be merged. The drawn charts are very ugly... It is good that data can be exported ....
8. Set the load generator

The server Load balancer machine is the loader that is controlled to run the test. You must run opensta name server and right-click Configure-repository host (dizzy! Only the word "repository" is displayed on the page. It is not completely displayed ...) -Enter the IP address of the Controller that runs opensta commander. Note that you need to restart the service after modifying the repository host. In this way, in the commander of the master control machine (Controller), set host name-enter the IP address of the Server Load balancer machine. Done.

This seems to be some confirmation, because if I want to control the running test cases of another machine, I need to specify the IP address of my machine on another machine, when I use another machine as the controller, I need to modify the settings of those machines, which is not as convenient as LoadRunner and does not need to be modified.

9. Summary

I have used LoadRunner and webload and other tools. The overall feeling is that opensta is still good, which makes people feel small and concise. It is very flexible to implement parameterization through variables, and opensta is a good choice when building a relatively simple performance test case for a scenario. However, opensta has many shortcomings:

    • The scripting language is too complex and it is quite difficult to customize scripts.
    • It does not seem to support setting the set point.
    • The scenario design is too simple, and it is difficult to build complex scenarios.
    • Linux performance data cannot be collected
    • Using repository to manage test scripts and configurations is too simple. You cannot select the path for saving the scripts.
    • The charts reported by the results are too simple and have little functionality!
    • The controlled end of the load generator is not properly designed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.