Article Directory
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
- 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.
- 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.
- 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)
- 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.
- 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
- 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
- General Performance Test
Whether the performance indicators are met under normal conditions and system conditions.
- load test
Validate the system Extend the run time of the system at a certain pressure until the system reaches a "knee point"
- 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)
- stability test
Verify that the system is running continuously, and check various performance indicators of the system.
(See if there is a memory leak)
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
After installation, there are these three software.
- Virtual User Generator (VUG): Mainly used to generate performance test scripts.
- Controller: Create and design test scenarios, run test scripts, monitor scenario execution, and collect test process data.
- Analysis: Analyze performance test results, and generate test reports and various charts.
5. Use VUG
Create a new performance test script
4.1 Open the web system that comes with LR
- Start the webTours service:
- After the startup is successful, don't close the command box, visit http://127.0.0.1:1080/WebTours/ in the browser
- View WebTours system login account:
The default account provided by Web Tours is:
The password provided by this default account is: bean
4.2 Writing performance test scripts
- Open the function tool library provided by WebTours
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
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
after running the program
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.
6.3 Checkpoint (web_reg_find)
Note: checkpoint must be placed before request
This will prompt you to find the text of "jojo" on the page, and the corresponding search times.
6.4 Parameterization
Give the parameter a variable name
What parameters are passed in the settings
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.
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.
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.
Click OK to open the Controller software automatically
- Policy to initialize virtual users before scripts run
- start virtual user
- The time the virtual user was running
- end virtual user
Run the scene
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.
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.
- performance test report
- 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.
precessor Time
CPU usage time, the amount of processor time consumed
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.