Proficient in performance testing from 0 to 1, requirements to actual stress test examples (details) you have everything you want...


foreword

Performance test requirement analysis stage
Generate a performance test requirement questionnaire based on user usage habits and actual business performance requirements;
select typical services based on performance test requirements and system important business research;
understand the business model and business architecture;

Performance test design phase
Write performance test cases;
record/modify/perfect test execution scripts in combination with performance test cases;
design performance test execution scenarios in combination with user application scenarios;

Performance test execution stage
Use the Controller application in the Jmeter performance test tool to execute scenarios according to the number of concurrent users, and save the test results;
use the Jmeter performance test tool to monitor the usage of system resources such as server CPU, memory, and disk in the tested environment;
If necessary, use third-party monitoring tools to monitor the resource usage of the system under test;
for reliability tests, perform tests for a long time to check whether the system will have memory leaks, downtime, etc.;

Performance test analysis stage
Analyze the results of the scenario execution;
monitor the system with the help of other auxiliary tools if necessary, such as Linux system top and other commands or other auxiliary tools, to further analyze the usage of system resources;

Performance testing and tuning stage
Through comparative analysis with previous test results, it is determined whether the performance of the system is improved after adjustment.
When performing performance adjustments, it is best to adjust only one content or one type of content at a time, to avoid performance improvement caused by adjusting multiple items at a time, but it is not known which key indicator is adjusted to improve performance. Usually, we tune system performance in order from easy to difficult.

The order of system tuning from easy to difficult is as follows:
hardware problems; network problems; application server, database and other configuration information; source code, database script problems; system architecture problems. Performance test report.

A simple stress test example

1. Performance testing requirements

Response time ≤20S
Web environment 100M intranet of the company
Pressure testing environment Production Environment Stress Test: Simulating Comprehensive Business Scenarios
Business scene The inventory query function is migrated from the background to the mobile terminal: there are 800 query entries in the background, and 6400 entries in the mobile terminal
server configuration Cloud Server

2. Requirements Analysis
The requirements are as above, and the three most concerned indicators of performance testing are: response time, TPS, and resource usage.

According to the requirements, under the premise that the response time cannot exceed 20 seconds, the maximum processing capacity of the server can be obtained through the stress test; and it is only an inventory query function. Because it is an online stress test, the business scenario can be guaranteed to be real and reliable.

3. Scenario Modeling
The stress testing environment is a production environment, so the intersecting business scenarios are more complex. The inventory query function is aimed at the cloud server, and other parts of the business are sent to the database through the application server, and the database is separated from reading and writing, so temporarily Regardless of database performance issues.

4. Test data preparation
There are generally several methods for the source of test data:
①. Completely back up the production data: the advantage is that it is completely authentic and reliable, but the disadvantage is that the test data is easy to cause data pollution during the test. isolation to ensure data availability as much as possible.

②. Generate data by simulating business scenarios and running scripts or scheduling tasks: When the amount of test data is not large, test data can be prepared in this way.

The premise here is to perform a stress test in the test environment, and this stress test is directly in the production environment, so the problem of the test data has been solved.

5. Script development and debugging
The test tool is jmeter, because it is only for the function of querying inventory, so only a single interface pressure test is required.

The advantage of using test tools to design test scripts is that it saves a lot of tedious processes. To debug scripts, you first need to perform interface tests to ensure that the tested interfaces are correct and available, then perform single-interface benchmark tests, and finally perform stress tests.

6. Script execution and record monitoring
Script execution:
In the process of script execution, it is necessary to gradually increase the number of concurrency from small to large, and record each test result. Due to the influence of the network and other conditions, the best way is to execute with the same number of concurrency After multiple tests, the weighted average value is relatively reliable.

By recording the test data after the continuous pressure test, you can observe the changes in response time, TPS, resource usage and other values, and then analyze them.

Record monitoring:
record the results of each test execution, monitor the database response time, number of connections, server memory, disk usage and other values.

PS: Since the pressure test is performed directly in the production environment, real-time monitoring is required to avoid serious situations such as service downtime caused by the pressure test.

The three most important values ​​for performance testing: response time, TPS, memory, disk usage --- monitoring (jmeter plug-in, serveragent)

7. Result analysis and bottleneck location
Through the test data obtained from the above test, targeted analysis can be carried out, such as whether resources, memory, number of connections, etc. are saturated during the stress test, whether there are threads waiting, database response time, etc. Then tune by elimination and prioritization.

Exclusion method: Analyze and exclude several factors that may affect performance one by one;
Priority: According to the actual situation, evaluate the time and resources needed for tuning, prioritize, and choose the most appropriate plan.

8. Tuning and verification
Some simple tuning methods:
memory, disk: simple and rude way, just add the server directly;
database: change the number of configured connections, add index, read and write separation, sub-database, partition, sub-table, Physical view and other means;
connection pool: optimize the connection pool configuration, increase the number of connections, etc., and follow-up updates;
front-end: reduce request connections, put data packets in the body as much as possible, compress images, asynchronously load, put JavaScript scripts at the end of HTML, etc. means, specific follow-up updates;

The following is the most complete software test engineer learning knowledge architecture system diagram in 2023 that I compiled

1. From entry to mastery of Python programming

Please add a picture description

2. Interface automation project actual combat

Please add a picture description

3. Actual Combat of Web Automation Project

Please add a picture description

4. Actual Combat of App Automation Project

Please add a picture description

5. Resume of first-tier manufacturers

Please add a picture description

6. Test and develop DevOps system

Please add a picture description

7. Commonly used automated testing tools

Please add a picture description

Eight, JMeter performance test

Please add a picture description

9. Summary (little surprise at the end)

The road is long and long, and only the courage and perseverance to keep moving forward can lead to the other shore of dreams. Adhere to the belief, keep the enthusiasm, and be down-to-earth, and you will be able to create a wonderful life of your own!

Life is short and precious, we must cherish time and pursue excellence. Don't give up because of difficulties, face challenges bravely, carry forward your strengths and expertise, work hard and make the future better!

The journey of life is full of changes and uncertainties, but only by strengthening one's beliefs and persistently pursuing dreams can one achieve success. Keep enthusiasm, keep learning and improving, feel with your heart, practice down-to-earth, and create your own wonderful life!

Guess you like

Origin blog.csdn.net/shuang_waiwai/article/details/130727877