Performance testing (LoadRunner)

1. Overview of performance testing

The quality of the performance test needs to be displayed through the data, and the performance is judged by the data corresponding to the performance index.

2. Common performance indicators

Number of concurrent users, response time, transaction response time & transactions per second, hit rate, throughput, resource utilization

  1. concurrent users

Concurrent users can stress the system.

The number of concurrent users at the business level: refers to the number of users who send requests to the server at the same time.

The number of concurrent users at the backend server level: refers to the number of requests sent to the server at the same time.

(It doesn't mean that the server will definitely cause pressure as long as the request is made)

Concurrent operations that stress a large number of users and simultaneity stress the server.

  1. Response time

Response time is divided into front-end display time and system response time.

The front-end display time refers to the time it takes for the client to render the front-end page after receiving the data returned by the server.

The response time of the system is divided into the time for communicating and processing requests between various servers such as web servers, application servers, and database servers.

  1. Transaction Response Time & Transaction Passes Per Second (TPS)

For example: when using electronic payment operations, the background processing may need to go through the accounting system, support system, banking system, etc. This is an operation involved in electronic payment transactions.

For users, they generally only pay attention to how long the entire payment took. And the process of this whole transaction is called the response time of the transaction .

The number of transactions per second usually refers to the number of successfully completed transactions per second, which is an important indicator to measure the processing capacity of the system.

The higher the number of transactions per second, the better the performance (this is relative, different systems have different requirements, and some transactions are more complicated)

  1. click rate

The number of hits per second represents the number of requests submitted by users to the server. The higher the hit rate, the greater the pressure on the server.

Note: The click here is not a click of the mouse, and one click may have multiple requests.

  1. throughput

The number of customer requests processed by the system per unit time directly reflects the performance capability of the software system.

Throughput is affected by server performance and network performance. Unit: bytes/s

  1. resource utilization

The usage of different system resources, including CPU, memory, hard disk, network, etc.

3. Classification of performance tests

General performance test, load test, stress test, stability test

  1. General Performance Test

Whether the performance indicators are met under normal conditions and system conditions.

  1. load test

Validate the system Extend the run time of the system at a certain pressure until the system reaches a "knee point"

  1. pressure test

Verify the performance of the system when it is already under extreme load or a certain indicator is already in a saturated state.

(Be sure to crash the system to understand the system's tolerance limit)

  1. stability test

Verify that the system is running continuously, and check various performance indicators of the system.

(See if there is a memory leak)

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-lHpUX0wM-1682247290795) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681206648314.png)]

4. Introduction to the loadRunner tool

How to calculate the data corresponding to the performance indicators requires the use of performance testing tools.

The specific installation here can be seen in this blog, which is written in detail

(259 messages) LoadRunner installation tutorial (and Chinese version installation)_Aying-fu's Blog-CSDN Blog

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-7OrqDKVL-1682247290796) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681210805730.png)]

After installation, there are these three software.

  1. Virtual User Generator (VUG): Mainly used to generate performance test scripts.
  2. Controller: Create and design test scenarios, run test scripts, monitor scenario execution, and collect test process data.
  3. Analysis: Analyze performance test results, and generate test reports and various charts.

5. Use VUG

Create a new performance test script

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-atcXro58-1682247290797) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681211742850.png)]

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-NL2COZWX-1682247290797) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681212166243.png)]

4.1 Open the web system that comes with LR

  1. Start the webTours service:

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-i1W6E9r6-1682247290798) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681271305809.png)]

  1. After the startup is successful, don't close the command box, visit http://127.0.0.1:1080/WebTours/ in the browser

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-aVokGt4Y-1682247290799) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681271446059.png)]

  1. View WebTours system login account:

The default account provided by Web Tours is:

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-iWt2HJU7-1682247290799) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681288948720.png)]

The password provided by this default account is: bean

4.2 Writing performance test scripts

  1. Open the function tool library provided by WebTours

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-AXjDZu91-1682247290799) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681289560929.png)]

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-CwWLqopY-1682247290800) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681289766170.png)]

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-2JVky9hO-1682247290800) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681370415290.png)]

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-qPyOHn67-1682247290801) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681370688058.png)]

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-IRgHN1Mp-1682247290801) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681370892075.png)]

Action()
{
    
    
// 1. 访问 http://127.0.0.1:1080/WebTours/ 首页
// 2. 输入登录的账号和密码  
	web_url("index",
		"URL=http://127.0.0.1:1080/WebTours/",
		"TargetFrame=",
		"Resource=0",
		"Referer=",
		LAST);
	web_submit_form("login",
		ITEMDATA,
		"Name=username", "Value=jojo", ENDITEM,
		"Name=password", "Value=bean", ENDITEM,
		LAST);
	return 0;
}

run script

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-QMqvYWUw-1682247290802) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681371320877.png)]

This is the simplest way of writing performance test scripts, but this way of writing is not enough for us to collect performance test data. It must be in a concurrent situation, that is, operations performed by a large number of users at the same time.

6. Enhancement of performance test script

6.1 Transaction (lr_start/end_transaction)

开启事务:lr_start_transaction
结束事务:lr_end_transaction

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-UTAus8LW-1682247290803) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681372233064.png)]

after running the program

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-MYtIBJ7J-1682247290803) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681372587407.png)]

6.2 Rendezvous (lr_rendzvous)

If we create 100,000 virtual users to execute the written performance test script later, we cannot guarantee that all virtual users will execute each step at the same time . In order to achieve concurrency in a true sense , let the virtual users execute to the rendezvous point A short-lived collection that executes the next step together after a condition is met.

**[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-Th7Kpich-1682247290804)(C:\Users\28463\AppData\Roaming\Typora\typora-user- images\1681375212787.png)]**

6.3 Checkpoint (web_reg_find)

Note: checkpoint must be placed before request

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-oaQkxxfG-1682247290805) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681376240748.png)]

This will prompt you to find the text of "jojo" on the page, and the corresponding search times.

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-JDH8mjFn-1682247290806) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681376094676.png)]

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-LLRPuvdO-1682247290807) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681376329389.png)]

6.4 Parameterization

Give the parameter a variable name

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-DEhkkpNP-1682247290807) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681376791691.png)]

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-47Cz7Sfg-1682247290808) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681377768354.png)]

What parameters are passed in the settings

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-6Hd7sHRM-1682247290808) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681377748362.png)]

6.5 Log Settings

Set the log, and finally press ctrl+s to save

Number or iterations: modify the number of times the action script is executed, and will not affect the init and end scripts.

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-8kgRKx8Y-1682247290809) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681378468216.png)]

7. Script recording

Use the recording function to automatically generate performance test scripts

Note that you must use the IE browser. If you use other browsers (Edge), no code will be generated even if it is recorded, and the content of the action file is always empty.

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-k30KAsVC-1682247290809) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681379240576.png)]

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-sCFKQe4w-1682247290810) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681379494777.png)]

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-Zj8INA1m-1682247290810) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681380495717.png)]

8. Using the Controller Tool

You can directly open the Controller software,

You can also open the controller tool for the scripts we have written to create test scenarios.

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-S6XRdmxE-1682247290810) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681380926416.png)]

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-N5vFGeYO-1682247290811) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681381034042.png)]

Click OK to open the Controller software automatically

  1. Policy to initialize virtual users before scripts run

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-hBqZZzau-1682247290811) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681381765068.png)]

  1. start virtual user

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-ER9EZq1U-1682247290812) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681382065154.png)]

  1. The time the virtual user was running

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-EJIeJ8B3-1682247290812) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681382211617.png)]

  1. end virtual user

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-XTqzmWjg-1682247290812) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681382881070.png)]

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-oWsMiwkL-1682247290813) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681383045210.png)]

Run the scene

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-pwPFIS7P-1682247290813) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681383670729.png)]

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-csS6Ducw-1682247290813) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681385064490.png)]

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-TFq1GJeR-1682247290814) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681385277529.png)]

If you want to check the system resource consumption during the execution of the performance test, you need to open the relevant system settings to allow LR to obtain the corresponding data.

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-1ZU3DdDG-1682247290814) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681453400672.png)]

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-SHmFs10h-1682247290815) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681454157319.png)]

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-iyHoWcrk-1682247290815) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681455080810.png)]

9. Use of Analysis tools

After running the Controller tool, it will automatically open the Analysis tool to generate a performance test report and analyze the results.

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-sk9WoDr9-1682247290815) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681455719509.png)]

  1. performance test report

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-NSAyeumJ-1682247290816) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681456108890.png)]

  1. test report

(1) Running virtual user diagram: Running vusers

According to the number of running virtual users displayed, the load on the server can be judged in which time period

(2) Click rate graph (clicks per second): Hits per Second

You can also judge the load of the server within a certain period of time through the click-through rate

(3) Throughput graph: Throughput

The throughput graph and the click-through rate graph are a bit similar, but the throughput graph curve is slightly behind, because the throughput represents the number of resources that respond to the response, and there must be a request before the return.

If there are more requests but no change in throughput, it may be because

  • The server was slow to respond, and it was too late to respond.
  • No stress to the server.
  • The server designs a certain threshold, and does not return a response after exceeding the number of requests.

(4) Transaction diagram: Transaction Summary

(5) Average transaction response time graph: Average Trans…esponse Time

In this figure, it is analyzed that the number of hits per second of virtual users on the server during the performance test can help evaluate the load generated by virtual users based on the number of hits.

If you want to view more charts, right-click to add them.

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-bsn7mo4b-1682247290816) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681459378132.png)]

  1. precessor Time

    CPU usage time, the amount of processor time consumed

  2. Available MBytes

    Available physical memory, generally based on this indicator to calculate how much physical memory is consumed

    Consumed physical memory = actual memory - available physical memory.

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-VisQRxK3-1682247290817) (C:\Users\28463\AppData\Roaming\Typora\typora-user-images\ 1681460325352.png)]

Guess you like

Origin blog.csdn.net/m0_58761900/article/details/130328203