System design-Number of concurrent users and throughput

Source: Internet
Author: User

When designing a system, the architect wants to build a high-performance system, and the throughput (TPS) is an important indicator of the performance of the system. When doing performance testing, testers need to understand the number of concurrent users of the system, system throughput, and response time, and so on, according to the relationship between the following simple collation as follows.

1. Response Time: The time required to respond to the request
Network transfer time: N1 + N2 + N3 + N4
Application Server processing time: A1 + A3
Database server processing time: A2
Then Response time = N1 + N2 + N3 + N4 + A1 + A3 + A2

2, the calculation formula of concurrent user number
Number of system users: the number of system-rated users, such as an OA system, the total number of users who may use the system is 3,000, then this number is the number of system users.
Simultaneous online Users: The largest number of simultaneous online users within a certain timeframe.
Simultaneous number of users = number of requests per second RPS (throughput TPs) + Concurrent connections + average user think time

    • Calculation of the average concurrent user count: C = n * l/t

Where c is the average number of concurrent users, n is the average number of access users per day (login session), L is the average time of the day the user logs on to the exit (the average time of the login session), T is the length of the study (how long the user uses the system within a day)

    • Peak Concurrent User count: C1 = C + 3 * SQR (c)

Where C1 is the peak of concurrent users, C is the average number of concurrent users, and SQR (c) represents the square root of C.

Example:
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 Equation 1 and Equation 2, you can get:
C = 400 * 4/8 = 200
C1 = 3 * SQR (200) = 242


3, the calculation formula of the throughput
Throughput: The number of requests that the system processes the user in per unit time
From a business perspective, throughput can be measured by: Number of Requests/sec, pages per second, number of people per day, or number of transactions/hours per hour.
From a network point of view, throughput can be measured in bytes per second:

The Swallow metric (pressure capability) of a system is closely associated with the request for CPU consumption, external interfaces, Io, and so on. The higher the CPU consumption of a single reqeust, the slower the external system interface and IO effect, the lower the system throughput capacity, and the higher the reverse.
System throughput Several important parameters: QPS (TPS), concurrency number, response time.
QPS (TPS): Number of request/transactions per second
Concurrent Number: The number of request/transactions that the system processes concurrently
Response time: Average response time is generally taken
Once you understand the meaning of the above three elements, you can deduce the relationship between them:
QPS (TPS) = concurrent number/average response time, or
Concurrent Number = QPS * Average response time

Example:
A typical work check-in system, 8 hours 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.
QPS = 1000/(30*60) Transactions/sec
Average response time = 5*60 seconds
Concurrent Number = qps* Average response time = 1000/(30*60) * (5*60) = 166.7

Examples of VU and TPS conversions
TPS is the number of transactions per second, but the transaction is to rely on virtual user run out, if 1 virtual users in 1 seconds to complete 1 transactions, then TPS is obviously 1; if a business response time is 1ms, 1 users in 1 seconds to complete 1000 transactions, TPS is 1000 If a business response time is 1s, then 1 users can only complete 1 transactions in 1 seconds, to achieve 1000 TPS, at least 1000 users, so it can be said that 1 users can produce 1000tps,1000 users can also produce 1000TPS, mainly to see the response time speed.

4. How to get vu and TPS

    • Number of concurrent users (VU) acquisition

New system: There is no historical data for reference and can only be evaluated by the business unit.
Old system: for already on-line system, can choose peak time, the number of people who use the system in a certain time, these people think belongs to the number of online users, the number of concurrent users to take 10%, for example, in half an hour, the number of users using the system is 10000, then take 10% as the number of concurrent users is enough.

    • Throughput (TPS) acquisition

New system: There is no historical data for reference and can only be evaluated by the business unit.
Legacy system: For already on-line systems, you can select peak times, in 5 minutes or 10 minutes, to obtain the amount of business per transaction and total business volume of the system, calculate the TPS according to the number of times completed in the unit time, that is, the number of business/unit time (5*60 or 10*60)

Therefore, for large systems, high volume of traffic, enough hardware configuration, 5000 user concurrency is sufficient, for small and medium-sized systems, 1000 user concurrency is sufficient.

5. TPs and hardware, network configuration

    • Datum parameters

Average response time 1S
TPS Peak 242
Average page size 20KB
Average 20 images per page, average size 50KB per image

    • PV estimation

Average 8 hours of work per day is estimated at peak value, TPS * 8 * 60 * 60 = 6969600

    • Database estimation

Assuming that each page performs an average of 3 SQL, each SQL takes an average of 100 milliseconds, and the database requires a concurrency of 3 * 242/0.1s = 73

    • Bandwidth estimation

Application server bandwidth, average page size 20KB, average response time 1S, removal of database interaction time (1000MS-3 * 100ms) after 700ms, average per requst bandwidth is 28.57kb/s, maximum bandwidth 242 * 28.57/1024 = 6.75MB /S
Image server bandwidth estimation similar to Application server

    • CPU estimation, Memory estimation

For solutions for 10 million PV (concurrent 100 users) sites per day:
Processor: 8 Core memory: 16G Bandwidth: 50Mbps
Database Memory: 16G

System design-Number of concurrent users and throughput

Contact Us

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.