Performance Test - Concurrent User Count Estimation (Ultrafine Finishing)

foreword

The number of concurrent users: refers to the users who operate the business in the real system. In performance testing tools , it is generally called the number of virtual users (Virutal User).

The concept of the number of concurrent users is different from the number of registered users and the number of online users.

The number of concurrent users will definitely put pressure on the server;
while the number of online users is only "hanging" on the system and does not put pressure on the server;
the number of registered users generally refers to the number of users existing in the database;

TPS: Transaction Per Second, the number of transactions per second, is a very important indicator to measure system performance.

TPS is the number of transactions per second, but the transaction is based on the number of virtual users. If a virtual user completes a transaction within 1 second, then TPS is obviously 1;

If the response time of a certain business is 1ms, then a user can complete 1000 transactions within 1 second, and the TPS is 1000;

If the response time of a certain business is 1s, then one user can only complete one transaction within one second. To achieve 1000TPS, at least 1000 users are needed;

Therefore, it can be said that 1 user can generate 1000TPS, and 1000 users can also generate 1000TPS. It depends on the response time.

That is to say, when evaluating the performance of the server, TPS and the number of concurrent users should be combined to measure the performance of the system based on TPS and supplemented by the number of concurrent users.

If you must use the number of concurrent users to measure, you need a premise, that is, how long does it take for the transaction to complete, because when the system load is not high, add the thinking time (the value of the thinking time is equal to the transaction response time) to In the script, the number of concurrent users can basically be doubled, so it does not make much sense to use the number of concurrent users to measure the performance of the system.

In performance testing, it is not necessary to use tens of thousands of concurrent users for testing. If it is only necessary to ensure that the system processes business quickly enough, hundreds or even dozens of users can achieve the goal.

It is understood that the performance test projects done by many experts basically do not exceed 5000 concurrent users. Therefore, for a large system with a very high business volume and sufficient hardware configuration, 5000 concurrent users are sufficient; for small and medium-sized systems, 1000 concurrent users are sufficient.

Several important parameters of system throughput: TPS, concurrency, response time

TPS: the number of transactions per second
Concurrency: the number of transactions processed by the system at the same
time Response time: generally take the average response time

TPS=number of concurrent users/(response time+Thinktime)

How are concurrent users counted?

1. Classic formula
Generally speaking, use the following empirical formula to estimate the average number of concurrent users and peak data of the system

The average number of concurrent users is C = nL/T
The peak number of concurrent users C' = C + 3*root C

C is the average number of concurrent users, n is the number of login sessions, L is the average length of login sessions, and T is the length of time for value inspection

C' is the peak number of concurrent users

Example 1:
Assuming system A, the system has 3000 users, and there are about 400 users accessing the system every day on average (can be obtained from the system log). The average time is 4 hours, and within a day, users only use the system within 8 hours.

Calculation:
The average number of concurrent users is: C = 4004/8 = 200
The peak number of concurrent users is: C' = 200 + 3 root 200 = 243

Example 2:
A company has designed a salary system for its 170,000 employees. Employees can enter the system to check their own salary information, but not everyone will use this system. Suppose only 50% of people will use the system regularly. 70% of people use the system once in the last week of each month, and the average time of using the system is 5 minutes.

Then the average number of concurrent users in the last week of a month is (9 to 5):

n = 1700000.50.7/5 = 11900
C= 11900*5/60/8 = 124

The throughput is calculated as: F = Vu * R / T in unit/s

F is the transaction throughput, Vu is the number of virtual users, R is the number of requests sent by each virtual user, and T is the time spent processing these requests

2. General formula
For most scenarios, we use (total number of users/statistical time) * impact factor (generally 3) to estimate the amount of concurrency.

For example:
taking the subway as an example, the number of passengers per day is 50,000, the morning peak is from 7 to 9 o'clock, and the evening peak is from 6 to 7 o'clock. According to the 8/2 principle, 80% of passengers will take the subway during peak hours. Then the number of people arriving at the subway ticket gate per second is 5000080%/(36060)=3.7, about 4 people/S. Considering factors such as security check and entrance closure, the actual number of people accumulated at the ticket gate must be larger than this, assuming that each person It takes 3 seconds to enter the station, so the actual concurrency should be 4 people/s3s=12. Of course, the impact factor can be increased according to the actual situation!

3. According to the PV calculation formula,
for example, for a website, the daily PV is about 1000w. According to the 2/8 principle, we can think that 80% of the 1000w PV is completed within 9 hours a day (human energy is limited), then TPS for:

1000w80%/(93600)=246.92 pieces/s, taking experience factor 3, then the concurrent amount should be:
246.92*3=740

4. Estimated according to TPS
The formula is C = (Think time + 1)*TPS

5. Calculate according to the number of system users
Concurrent users = 8% to 12% of the maximum number of online users in the system

Finally, I would like to thank everyone who has read my article carefully. Reciprocity is always necessary. Although it is not a very valuable thing, you can take it away if you need it:

These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey, and I hope it can help you! Partners can click the small card below to receive    

 

Guess you like

Origin blog.csdn.net/kk_lzvvkpj/article/details/132364369