During performance testing, we often hear the terms of concurrent users, response time, and throughput. Maybe everyone understands that there is a level and depth of understanding here. I recently read the book "detailed explanation of Software Performance and case analysis" and read his explanation. It turns out that my understanding of these terms is superficial. In fact, this is also subject to your own knowledge. So, let's take a look at it again.
PS: follow the Convention to first create a graph, because the plain textArticleTired! Pai_^
Concurrent users
We all know that our performance tests use tools to simulate multi-user operations on the system, which puts pressure on the system to verify the system performance (not a standard interpretation ). Many people simply regard performance testing as a concurrency test. Therefore, the "multi-user" and "same time" factors are indispensable. When only multiple users are at the same time, it is difficult to put pressure on the system. Without multiple users, the concept at the same time naturally does not exist.
Concurrency
One is strict concurrency, that is, all users perform the same thing or operation at the same time. This operation generally refers to the same type of business. For example, all users perform concurrent login at the same time and form submission at the same time.
Another concurrency is concurrency in a broad range. The difference between this concurrency and the previous concurrency is that although multiple users send requests or perform operations to the system, however, these requests or all operations can be the same or different. For example, a user logs on at the same time and a user submits a form.
Concurrency from the server perspective
Both of the preceding explanations are about concurrency from the perspective of the user's business, because the performance tests we perform at ordinary times also perform concurrency tests on operations at the business layer on the user end.
If the pressure on the server during the entire system operation is considered as follows: During the system operation, the entire operation process is divided into discrete time points, at each point, there is a "number of customers who send requests to the server at the same time", which is the so-called maximum number of concurrent workers of the server.
True concurrency does not exist
After talking about so many concurrent jobs in the interview, I now say that the real concurrency does not exist. Why? Everyone who learns operating system principles knows,CPUYou can do only one thing at a time point. Why can we watch movies, type, and voice. BecauseCPUSoon, he could take a look at the movie, then process the typing, and then process the voice. Because it is fast, it can beProgramThe instant switching between them creates the illusion that they are doing these tasks at the same time. (The current dual-core, quad-coreCPUAlso)
Then our system also needs to callCPUAnd then return it to the user. So what is the test of system concurrency? Here is a simple example. For example, if a medical doctor sees a doctor very quickly and assumes that his medical treatment speed remains the same, then a group of reception staff will receive the guest who sees the Doctor, and thousands of patients will visit the doctor, the reception staff should find various ways to do a good job of reception, so that patients can see the disease more quickly. For example, you can consult the patient in advance and classify the patient. For example, you can expand the reception room so that more patients can go to the hospital to see a doctor.
Medical Doctor is ours.CPUThe reception staff is our system, and the patient is the user. The purpose of our performance test is to know where the reception staff is causing a bottleneck for the hospital. The speed and service of seeing a doctor in a hospital is good. All of a sudden, a variety of problems have emerged for 100,000 patients. The service attitude of the reception staff is decreased, the redundant staff cannot go to the hospital, and the hospital's restroom is not enough. As a result, the patients cannot go to the hospital and leave. These are all system problems. Therefore, we generally test the purpose of the hospital reception capability.
Number of system users and number of simultaneous online users
In actual performance tests, we often come into contact with the concepts related to concurrent users, including "number of system users" and "number of simultaneous online users". An example is provided to describe the differences between them.
assume that a registered user can log on to a website to use various functions, such as uploading portraits and reading expert articles. The system has 20 registered users, this means that 20 ten thousand users can use all the functions of this website. 20 is the" number of system users "of the website. The website has an online statistics function, from the statistics, we can see that the highest number of people logging on to the website at the same time is 2 ten thousand, that is, 2 tens of thousands of people simultaneously open this website in a browser. 2 means" number of concurrent online users "
What is the number of concurrent users of the system?? 2Ten thousand?No!This2Means that at the peak of the system, so many users have logged on to the website, not the pressure on the actual server. Because the load on the server is also related to the specific user access mode2The number of requests sent by a user at a certain time point in the tens of thousands of users can be greatly reduced. So what is the maximum number of concurrent workers that the system server can afford? This depends on the number of concurrent users and business scenarios, which can be obtained by analyzing server logs.
Formula for calculating the number of concurrent users
In actual performance testing, testers are generally concerned with the number of concurrent users of the business, that is, the number of concurrent users to be set from the business perspective is reasonable.
Next we will look for a typical attendance system. In the morning8Work,7Point half8Vertex's30In minutes, the user will log on to the system to sign in. Employees of the company are1000Person, the average length of Logon Time for each member to sign in to the system5Minutes. You can use the following method for calculation.
C = 1000/30.* 5= 166.7
CIndicates the average number of concurrent users, so the average number of online users per minute for this sign-in system is166
Of course, in performance testing, any formula is not rigorous. The most important thing is to make effective and correct analysis on the system.
--------------------------
According The teaey reminder has been corrected. The calculation result is the number of online users per minute, not the number of concurrent users.