1. What is performance testing
First look at Baidu Encyclopedia's definition of it
Performance testing is to test various performance indicators of the system by simulating various normal, peak and abnormal load conditions through automated testing tools.
We can think of performance testing as: by detecting the performance of the system or components in the test environment, it is used to verify whether the system performance in the production environment is up to
According to the estimated performance requirements, the performance bottlenecks that may exist in the system are found, and then the optimization and system performance are improved, and the scalability and stability of the system are improved.
Learning performance testing, or analyzing test results requires familiarity with test indicators. Next, from the perspective of performance test analysis and measurement, introduce performance test
Test indicators of different dimensions.
2. System performance indicators
2.1 Response time
Response Time, referred to as RT, refers to the time from when the user initiates a request from the client to when the client receives the result returned from the server.
The time spent in the whole process. Does not include processing and rendering time for front-end pages. Intuitively, this indicator is very consistent with people's subjective feelings about software performance.
Yes, because it completely records the time it takes for the entire computer system to process a request. The absolute value of the response time does not directly reflect the performance of the software.
The level of performance actually depends on the user's acceptance of the response time.
2.2 System processing capacity
Refers to the ability of the system to process information by using the system hardware platform and software platform. The system processing ability is evaluated by the number of transactions that the system can process per second.
There are two understandings of transactions:
(1) A business process from the perspective of business personnel;
(2) A transaction application and response process from a system perspective.
The former is called the business transaction process, and the latter is called the transaction. Both transaction indicators can evaluate the processing capability of the application system. Typically, system processing power is used to
The following indicators to measure:
HPS (Hits Per Second): the number of hits per second, the unit is times/second
TPS (Transaction per Second): the number of transactions processed by the system per second, the unit is pen/second
QPS (Query per Second): The number of queries processed by the system per second, the unit is times/second
For Internet services, if some services have one and only one request connection, then TPS=QPS=HPS, generally TPS is used to measure the entire service
For the process, QPS is used to measure the number of interface queries, and HPS is used to represent click requests to the server.
2.3 Throughput
Refers to the number of requests processed by the system per unit time. For single-user systems, response time is a good measure of system performance; for concurrent systems, response time is a good measure of system performance;
Typically throughput is desired as a performance metric. Generally speaking, throughput is a more general indicator, two systems with different numbers of users and user usage patterns,
If their maximum throughputs are basically the same, it can be judged that the processing capabilities of the two systems are basically the same.
2.4 Number of concurrent users
Refers to the number of users who log in to the system and perform business operations at the same time. For a persistent connection system, the maximum number of concurrent users is the concurrent access capability of the system.
For the short connection system, the maximum number of concurrent users is not equal to the concurrent access capability of the system. The number of concurrent users, system architecture, and system processing capacity of the short connection system
related to various situations.
Compared with throughput, the number of concurrent users is a more intuitive but also more general performance indicator. In fact, the number of concurrent users is a very inaccurate indicator, because
Different usage patterns of users will result in different numbers of requests issued by different users per unit time.
2.5 Error rate
Error Rate refers to the ratio of the number of errors or failures that occur when processing requests to the total number of requests within a certain period of time. The error rate is usually expressed as a percentage
Formula representation, for example: 99% success rate or 1% failure rate, etc. The lower the indicator, the better the system performance.
3. Resource performance indicators
3.1 CPU
The CPU, also known as the central processing unit, is a very large-scale integrated circuit. It is the computing core (Core) and control core (Control Unit) of a computer.
Interpreting computer instructions and manipulating data in computer software.
The CPU indicator mainly refers to the CPU utilization rate, including: user state (user), system state (sys), waiting state (wait), and idle state (idle). Performance test CPU evaluation built
Negotiable value:
(1) The CPU utilization rate should be lower than the industry warning value range, that is, less than or equal to 75%
(2) CPU sys% is less than or equal to 30%
(3) CPU wait% is less than or equal to 5%
3.2 memory
The memory is the bridge to communicate with the CPU. All programs in the computer run in the memory, so the performance of the memory has a great impact on the computer.
In order to maximize the use of memory, the current operating system stores cache in memory, so 100% memory utilization does not mean that there is a bottleneck in memory. Measure system memory
The bottleneck mainly depends on the utilization rate of SWAP (swapping with virtual memory). Under normal circumstances, the utilization rate of SWAP exchange space is lower than 70%. Too many swaps will
cause poor system performance.
3.3 Disk throughput
Disk throughput is referred to as Disk Throughput for short, which refers to the amount of data passing through the disk per unit time without disk failure. Analysis indicators mainly include per second
How many megabytes are read and written, disk busy rate, number of disk queues, average service time, average waiting time, space utilization, etc. Among them, the disk busy rate is a direct reflection of the disk
It is an important basis for whether the disk has a bottleneck. Generally, the disk busy rate should be lower than 70%.
3.4 Network Throughput
Network throughput is referred to as Network Throughput for short, which refers to the amount of data passing through the network per unit time without network failure, and the unit is Byte/s.
The network throughput index is used to measure the system's demand for network equipment or link transmission capabilities. When the network throughput index is close to the maximum transmission capacity of network equipment or links,
You need to consider upgrading your network equipment. The network throughput index mainly includes how many megabytes of traffic enters and exits per second, and generally cannot exceed 70% of the maximum transmission capacity of the device or link.
4. Middleware indicators
Commonly used middleware such as Tomcat, Weblogic and other indicators mainly include JVM, ThreadPool and JDBC, as follows:
Level 1 indicators | Secondary indicators | unit | paraphrase |
GC | GC frequency | how many times per second | Partial collection frequency of java virtual machine garbage |
GC | Full GC frequency | how many times per hour | java virtual machine full garbage collection frequency |
GC | Average Full GC duration | Second | Average time spent in full garbage collection |
GC | Full GC maximum duration | Second | Maximum time for full garbage collection |
GC | heap usage | percentage | heap usage |
ThreadPool | Active Thread Count | indivual | number of active threads |
ThreadPool | Pending User Request | indivual | The number of user requests that are queued |
JDBC | JDBC Active Connection | indivual | JDBC active connections |
Reference standards for various indicators:
(1) The number of currently running threads cannot exceed the set maximum value
When the system performance is good, it is more appropriate to set the minimum value of the number of threads to 50 and the maximum value to 200.
(2) The number of currently running JDBC connections cannot exceed the set maximum value
When the system performance is good, it is more appropriate to set the minimum value of JDBC to 50 and the maximum value to 200.
(3) GC frequency should not be frequent, especially FULL GC should not be frequent
When the system performance is good, it is more appropriate to set the JVM minimum heap size and maximum heap size to 1024M respectively.
5. Database indicators
Commonly used database indicators mainly include SQL, throughput, cache hit rate, number of connections, etc., as follows:
Level 1 indicators | Secondary indicators | unit | paraphrase |
SQL | time consuming | microsecond | Time-consuming execution of SQL |
throughput | SWC | indivual | Queries per second |
throughput | Queries per second | indivual | transactions per second |
hit rate | Key Buffer Hit Rate | percentage | Index buffer hit ratio |
hit rate | InnoDB Buffer hit rate | percentage | InnoDB buffer hit rate |
hit rate | Query Cache hit rate | percentage | query cache hit rate |
hit rate | Table Cache hit rate | percentage | Table cache hit ratio |
hit rate | Thread Cache hit rate | percentage | thread cache hit rate |
Lock | Wait times | Second-rate | lock wait times |
Lock | waiting time | microsecond | lock wait time |
Guideline:
(1) The smaller the SQL time-consuming, the better, generally at the microsecond level;
(2) The higher the hit rate, the better, generally not lower than 95%;
(3) The lower the number of lock waiting times, the better, and the shorter the waiting time, the better.
6. Stability indicators
The stability here refers to the shortest stable time, that is, the system operates at 80% of the maximum capacity or the standard pressure (the expected daily pressure of the system), and can
Minimum time for stable operation.
Generally speaking, for a system running on a normal working day (8 hours), at least it should be able to ensure that the system runs stably for more than 8 hours; for a system running 7*24,
At least it should be able to ensure the stable operation of the system for more than 24 hours. If the system cannot run stably, after going online, with the growth of business volume and long-term operation,
There is a risk of performance degradation or even crashes.
Guideline:
(1) The TPS curve is stable without large fluctuations;
(2) There are no leaks or abnormalities in various resource indicators.
The following are the better learning tutorial resources I have collected. Although they are not very valuable, if you just need them, you can leave a message in the comment area [777] and just take them away
Friends who want to get information, please like + comment + favorite , triple!
After three times in a row , I will send you private messages one by one in the comment area~