One . Overview of performance testing
Performance test concept ：
Performance testing refers to a specific way of , Apply pressure to the system under test according to a certain strategy , Get system response time 、TPS、 Resource utilization and other performance indicators , In order to ensure that the performance of the production system can meet the needs of users .
Look at performance from different angles ：
User perspective ：
response time , stability
Development perspective ：
Architecture design , Database design , Code design
System administrator Perspective ：
The value of performance testing ：
Early detection of system peak operation fault Guide the development of burst traffic carrying scheme Make sure the system runs smoothly
Purpose of performance test :
Optimize performance Minimize costs Minimize risk Deliver high quality systems
The goal of performance testing ：
- Evaluate current system performance
- Looking for bottlenecks , Optimize performance
- Verify the stability and reliability of the system
Performance testing is a common term
Concurrency number ：
Number of users submitting requests to the system at the same time at a certain physical time . The best number of concurrent users ： It usually reflects the capacity of the system , That is, the processing capacity of the system .
response time ：
Response time refers to the start of a request from the client , Until the client receives the response returned from the server , The time it took .（ Network time + Application processing time ）
The number of customer requests processed by the system per unit time , Reflect the system's performance carrying capacity
TPS： The number of transactions completed by the application system per second .
QPS： The number of requests processed by the application system per second .
Resource utilization ：
The system is running under load , database server 、 application server 、web Server's CPU、 Memory 、 Hard disk 、 External storage , The utilization rate of network bandwidth .
Two . The main types of performance testing
The load test ：
By gradually increasing the system load , Test for changes in system performance , And finally determine in the case of meeting the performance indicators , Test of the maximum load the system can bear . The goal is ： Determine the performance capacity of the system （ For example, how many concurrent users can be allowed to access when the system guarantees a certain response time ）, System indicators , Such as throughput 、 response time 、CPU load 、 How memory usage determines system performance .
Pressure test ：
By gradually increasing the system load , Test for changes in system performance , And finally determine under what load condition the system performance is in failure state , And in order to get the maximum service level that the system can provide . The goal is ： Stress testing is about finding out under what conditions your application's performance becomes unacceptable .
Big data test :
- Mainly for the database has special requirements of the system testing .
- Large amount of real-time data , When there are many test users or some services produce a large amount of data , Whether the system can run stably .
- Large amount of historical data , Test system used for a period of time, that is, when the system accumulates a certain amount of data, whether it can run normally .
- The combination of the first two , When the test system has accumulated a large amount of data , Whether some modules that generate large amount of data in real time can be stable .
Single transaction load test ：
Single transaction under certain load pressure of the system , Using gradient to increase concurrency , Get the number of concurrent users when the single transaction system is optimal 、 Response time and system processing capacity . The purpose is to obtain the peak processing performance of single day trading business , And check and eliminate the possible performance problems of the transaction itself .
Hybrid trading test （ The database may produce a large number of deadlocks ）：
Design according to mixed scenes , Using gradient to increase concurrency , Until there's a performance inflection point , Get the number of concurrent users when the hybrid trading system is optimal 、 Response time and system processing capacity . The purpose of hybrid transaction is to obtain the performance of the whole system under different load levels , Check and eliminate possible concurrency problems between transactions .
3、 ... and . The process of performance testing
1. Test design （ Performance requirements research , The project design , Make a plan ）
The project design ：
The principle of selection ：
- Test transactions should cover all channels ;
- Select high-frequency trading with large trading volume ;
- Choose a deal of high importance ;
- Choose transactions that take up more resources ;
- Select transactions with complex business logic ;
- Choose a transaction with a long trading path ;
- Select transactions that take longer to process ;
- Select transactions that have been or are prone to problems in production ;
Design method ：
1. Analyze the business volume operation of various normal days and special days of the business system
2. Analyze the actual business distribution 、 Transaction type and transaction volume 、 Share of transactions , According to the proportion of business distribution and transaction , Determine the matching of selected transactions in the test model , Build a test model .
Classification of common test scenarios ：
Normal business day trading scenarios Special day trading scenarios Peak trading scenario End of day batch processing scenarios
Performance indicators ：
TPS、ART、 Number of concurrent users ： Non functional performance requirements TPS Estimate ： First get the peak production period of the selected transaction TPS, If it is difficult to obtain the accounting principle ： TPS= n*80% m*20%*3600 (n: Daily trading volume m: Working hours per day ) Deal success rate ：99.99% System resource usage of each application server and database server ：CPU、 Memory 、IO、networke
2. Test preparation
Test environment ： Important systems and new systems need to be the same as the production environment , Other optimization systems should keep 1:2 mixture ratio
Test data ： Developers prepare inventory data , Testers prepare parametric data （ Script ）
Testing tools ：LoadRunner,JMeter etc.
3. Test Development
4. The test execution
Common performance testing problems ：
TPS Substandard , Slow response time
A large number of transactions over time or failure report error , The success rate is lower than the target
TPS Big volatility is volatile
The system is not stable for a long time
There are a lot of deadlocks in the database
5. Analysis report