# How do I calculate the set concurrency number when using the test tool?

Source: Internet
Author: User

Methodology-1:

Number of simultaneous users online:
Average number of concurrent:
Peak number of concurrent users:

In the actual performance testing work, the tester is generally concerned about the number of business concurrent users, that is, from the business perspective should be set how many concurrent number is reasonable, so in the later discussion, is mainly for the number of business concurrent users to discuss, and, for convenience, The number of business concurrent users is referred to directly as the number of concurrent users.

(1) Calculate the average number of concurrent users: C = nl/t
That is: average concurrency = total number of users * user online time/Total working time

(2) Peak number of concurrent users: C ' ≈c+3*sqrt (c)

That is: peak concurrency = average concurrent number +3* (average concurrent number ^1/2)
In the formula (1), C is the average number of concurrent users; n is the number of login sessions; L is the average length of the login session; t refers to the length of the period of the visit.

The formula (2) gives the method of calculating the peak number of concurrent users, where C ' refers to the peak of the number of concurrent users, and C is the average number of concurrent users in the formula (1). The formula is derived from the assumption that the login session of the user is estimated to be in accordance with the Poisson distribution.

Instance:

Suppose there is an OA system, the system has 3,000 users, an average of about 400 users per day to access the system, for a typical user, the average user from logging on to exit the system in a day is 4 hours, in a day, the user only within 8 hours to use the system.

According to the formula (1) and the formula (2), you can get:

C = 400*4/8 = 200

C ' ≈200+3* radical 200 = 2421

Estimating processing power , typically with TPCC values, that is, processing requests per minute. Each server also takes the TPCC value as an indicator. This is related to the following factors:
1, number of concurrent users? (U1)
2, user access mode: The number of business requests per user, for example 0.2 (N1) each minute
If the database server, the statistical query, update, statistical ratio,
If it is a Web server, statistics, such as connection jumps, add operations, delete operations, update operations, the query operation accounted for 1/5
4, the number of transactions caused by the business request
For example, the average per page jump operation produces 6 transactions (T1), an average of 8 transactions per add operation (T2), 8 transactions per delete operation (T3), an average of 14 transactions per update operation (T4), and an average of 10 transactions per query operation (T5);
5, the number of busy hours is the average several times, for example 5 times times
6, empirical coefficients, e.g. 1.8
7, how much redundancy the server retains, typically 30%
Tpc-c=u1*n1* (t1+t2+t3+ t4+ T5)/5*3* empirical coefficient/redundancy factor

Methodology-2:

Number of concurrent users

We all know that our performance testing is a tool to simulate multi-user operation of the system, pressure on the system to verify the performance of the system (less standard interpretation). Many people also simply take performance tests as concurrency tests. Then this "multi-user" and "simultaneous" two factors are indispensable. It is difficult to stress the system because it is not a multi-user, and the concept of no more users is naturally absent.

Two cases of concurrency

One is the strict concurrency, that is, all users do the same thing or operation at the same time, this kind of operation generally refers to doing the same type of business. For example, all users do concurrent logins at the same time and do form submissions at the same time.

Another concurrency is generalized range of concurrency, which differs from the previous concurrency in that although multiple users have made requests or performed actions on the system, these requests or operations can be the same or different. For example, at the same time there are users logged in and there are users submitting the form.

Concurrency from a server perspective

Both of the preceding explanations are interpreted concurrently from the perspective of the user's business, because the performance tests we do usually perform concurrent testing from the client to the operations of the business layer.

If you consider the pressure on the server during the operation of the whole system is this: during the operation of the system, the entire operation is divided into discrete points of time, at each point, there is a "simultaneously to the server to send requests to the number of customers", this is the so-called servers to withstand the maximum number of concurrent access.

The real concurrency doesn't exist.

The above talk about so much concurrency, and now it is said that the true meaning of concurrency does not exist. Harry Learn the operating system principles of the students know that the CPU at a point in time can only do one thing. Why we can watch a movie, while typing, while the voice. Because the CPU quickly and quickly, he can deal with the film, then handle the typing, and then deal with the voice. Because it's fast, so it can switch between multiple programs quickly and instantaneously, giving you the illusion that it's doing these things at the same time. (now the dual-core, quad-core CPU said otherwise)

Then our system will call the CPU to complete some processing after receiving the user's request, and then return to the user. So what do we do with the concurrency test for the system? Give a simple example. If there is a magic doctor, his doctor speed is very fast, assuming that his doctor rate is unchanged, and then there is a group of reception staff to receive the doctor's guests, there are thousands of patients to see the doctor, reception staff to all kinds of ways to do the reception work, so that patients see the disease faster. For example, you can consult the patient in advance of what disease, and then classify the patients, such as can expand the reception room, so that more patients can go to the hospital to see the doctor.

Magic Doctor is our CPU, reception staff is our system, the patient on the user, we do the performance test is to understand the reception staff where the hospital caused the bottleneck. Only one patient, the hospital's speed and service is very good. A sudden 100,000 patients came out with all sorts of questions. Reception staff of the service attitude down, redundant personnel with this into the hospital, the hospital toilet is not enough to use, resulting in patients can not go on the left, these are system problems. Therefore, the purpose of our general test is to look at the reception capacity of the hospital.

Number of system users and concurrent online people

In real-world performance testing, there is a constant exposure to the concepts associated with concurrent users, as well as the "Number of system users" and "concurrent online numbers," which describe the differences between them.

Suppose there is a website, registered users can log in using various functions, such as uploading avatars, reading expert articles and so on. The system has 200,000 registered users, which means that there are 200,000 users can use all the features of this site, 200,000 is the site of the "Number of system users", the site has an online statistics function, from the statistics can be seen, while the number of people logged in the site is the highest record is 20,000, That is, 20,000 people are using the browser to open the site. 20,000 is "simultaneous online headcount"

So what is the number of concurrent users of the system? 20,000? No! This 20,000 only indicates that there are so many users logged into the site at the highest peak of the system, and it does not mean that the actual server is under pressure. Because the server under pressure is also related to the specific user access patterns, in these 20,000 users to examine a point in time to the number of users to make requests, can greatly shrink. So, what is the maximum number of concurrent accesses that the service side of the system is subjected to? This depends on the number of concurrent users of the business and the business scenario, which can typically be obtained through server log analysis.

Calculating the number of concurrent users formula

In the actual performance testing work, the tester is generally concerned about the number of business concurrent users, that is, from a business perspective should be set how many concurrency number is reasonable.

Below find a typical work check-in system, 8 in the morning to work, 7:30 to 8 30-minute time users will log in to the system to sign in. The company employs 1000 people, with an average of 5 minutes for each member to log on to the registration system. This can be calculated using the following method.

c=1000*5/30=166.7

C represents the average number of concurrent users, then the average number of concurrent users per second for this registration system is 166

Of course, in the performance test, any formula is not rigorous, the most important thing is to make effective and correct analysis of the system.

Methodology-3:

The maximum number of concurrent users of a system is 1100, how can the system to calculate the maximum number of users supported. The user performance requirements are as follows: Support 1 million registered users performance requirements analysis: 1, according to the requirements of users, the system to support 1 million users, wherein the performance of the machine configuration? What is the peak value? Bandwidth? such as 2, if the company's test environment, then the performance should do what kinds of performance? Performance evaluation, load testing, strength testing? 3, how to calculate the number of concurrent users? Response time? Performance indicators: Because the user's performance needs are too wide, no specific value. So how do I carry out the subsequent work? 1, determine the use of the company test environment, do not consider environmental issues. That is, the client, the server, and the bandwidth of a system can not be considered, this is fixed. 2, consider this project team developed before the system performance, can be used as a reference value. Solution: Identify the project team with two + projects, and its performance metrics are right. The Browse function: Concurrency number is 1100, average response time is 363 seconds, average response time per user is 0.33 seconds. 3 concurrent users per second. One of the system users has reached 5 million and another system user is 3.2 million. And the two systems have been operating normally, but the current two systems of the server are 3 units. You can draw a server to load 1.66 million, or even more. (Because the server has a rights-seeking relationship) 3, 1 million users, then how to calculate his hourly peak activity users? Solution: Use the 80 20 principle to calculate the number of peak active users per hour 66,670/hour, then the same function point per second Click Concurrency should be 18.5. 4, how to get its concurrency number? Solution: How many function points does the system have? Function point is 153, that is, the system at the peak value of a function will be clicked 1258 times, click 0.35 times per second. Consider the previous value of this project group (regardless of the interval). The initial set of concurrent number is 1100, mainly browse function, followed by query and new. 5, should test that type of performance after repeated consideration, three kinds of performance are tested. Execution performance: evaluation, according to the performance of the 3rd, set the concurrency of the user to 300-350, to see the situation. Load test, with 1100 as the starting strength test, for 15 hours and 24 hours for the quasi-performance test results: found that the maximum user support for the system is 1100. The user with the failure is up to 209 and the response time is 315. It can be judged that the maximum concurrency of this system is about 1100. It is said that the system can support 1.5 million users on a single server. According to the above situation, it can be concluded that: 1100 user concurrency, the user response time is 315 seconds (that is, the average response time per user 0.005 seconds), where the highest generation of 209 failed users, but the successful user can basically complete the follow-up operation, in line with the current system requirements of the maximum number of stable users. ByThis concludes that the system supports a maximum user concurrency of 1100 in the new feature point. According to the 1*100 ratio, the number of peak activity users per hour was calculated at 110,000/hour, and the 80 20 principle was used to calculate the number of registered users in this system is about 1.65 million. And this system performance demand large-scale support 1 million registered users, by the above data our system has reached the performance requirements of the system. Note: 1 million, the use of the 80 20 principle to calculate the peak activity per hour users 66,670/hour.

Wang Xiao Wang
Source: Know

How do I calculate the set concurrency number when using the test tool?

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.