About QPS, TPS, number of concurrent users and throughput

Reposted from: Micro reading https://www.weidianyuedu.com

1、QPS


QPS Queries Per Second is the query rate per second, which is the corresponding number of queries that a server can perform per second. That is the maximum throughput.

2、TPS


TPS Transactions Per Second is the number of transactions per second. A transaction is a process in which a client sends a request to a server and the server responds. The client starts timing when it sends a request, and ends timing after receiving the server's response, so as to calculate the time used and the number of completed transactions.

3. The difference between QPS and TPS


My personal understanding is as follows:

1. Tps is the number of transactions processed per second, including

  • user request server

  • The server's own internal processing

  • The server returns to the user

These three processes can complete N of these three processes per second, and Tps is N;

2. Qps is basically similar to Tps, but the difference is that one visit to a page forms one Tps; but one page request may generate multiple requests to the server, and the server can count these requests into "Qps" among.

example:


For example: accessing a page will request the server 3 times, and one time will generate a "T" and 3 "Q". , so are they the same? The answer is no, because it is impossible for this girl to eat 10 buns in one second, she may have to eat for a long time. At this time, the big eater is equivalent to TPS, and this girl is QPS. Although very similar, they are actually different.

4. Concurrent number


Concurrency number (concurrency degree): refers to the number of requests that the system can handle at the same time, and also reflects the load capacity of the system. This value can be obtained by analyzing the number of access logs in the machine within 1s

5. Throughput


Throughput refers to the number of requests processed by the system per unit time. TPS and QPS are common quantitative indicators of throughput.

System Throughput Elements

The throughput (pressure bearing capacity) of a system is closely related to the CPU consumption, external interface, IO, etc. of the request (request).

The higher the cpu consumption of a single request, the slower the impact of external system interface and IO, the lower the system throughput, and vice versa.

Important parameters

QPS (TPS), concurrent number, response time

  • QPS (TPS): the number of requests/transactions per second

  • Concurrency: the number of requests/transactions processed by the system at the same time

  • Response time: generally take the average response time

relation

QPS (TPS) = concurrent number / average response time

The throughput of a system is usually determined by two factors: QPS (TPS) and the number of concurrency. Each system has a relative limit value for these two values. Under the access pressure of the application scenario, as long as a certain item reaches the highest value of the system, the system throughput will If the pressure continues to increase, the throughput of the system will decrease instead. The reason is that the system is overloaded, context switching, memory and other consumption lead to system performance degradation.

6、PV


PV (Page View): Page views, that is, page views or clicks, which are counted every time a user refreshes. It can be obtained by counting the access logs of the service for one day.

7、UV


UV (Unique Visitor): unique visitors, counting the number of users who visit a certain site within 1 day. The access log of the service can be counted for one day and obtained by deduplication according to the unique identifier of the user. Response time (RT): Response time refers to the time for the system to respond to the request, and the average response time is generally taken. It can be obtained through Web Servers such as Nginx and Apache.

8、DAU


DAU (Daily Active User), the number of daily active users. Often used to reflect the operation of websites, Internet applications or online games. DAU usually counts the number of users who log in or use a certain product within one day (statistical day) (excluding users who log in repeatedly), which is similar to the concept of UV

9、CONTINUE


MAU (Month Active User): The number of monthly active users, which refers to the number of monthly active users after deduplication of websites, apps, etc.

10. System throughput evaluation


When we design the system, we need to consider the impact of CPU operation, IO, external system response factors and preliminary estimation of system performance.

Under normal circumstances, when we face the demand, we evaluate the QPS, in addition to the number of concurrency, there is another dimension: daily pv.

By observing the access logs of the system, it is found that when the number of users is large, the access traffic in the same time period in each time period is almost the same. Like every morning on weekdays. As long as we can get the daily traffic map and QPS, we can calculate the daily traffic.

Usual technical method:

1. Find the highest TPS and daily PV of the system. These two elements have a relatively stable relationship (except for holidays and seasonal factors)

2. Get the highest TPS through stress testing or empirical estimation, and then follow up the relationship of 1 to calculate the highest daily throughput of the system. The customer groups faced by B2B Chinese and Taobao are different. The network behaviors of these two customer groups are not applied, and the ratio of TPS and PV relationship between them is also different.

11. Basic concepts and calculation formulas of software performance testing


What performance needs to be paid attention to when doing performance testing of software?

First of all, the purpose of developing software is to allow users to use it. Let's first analyze from the user's point of view which features users need to pay attention to.

For the user, from clicking a button, link or sending an instruction until the system displays the result in a form perceived by the user, the time consumed by this process is the user's intuitive impression of the software's performance.

That is what we call response time. When the response time is small, the user experience is very good. Of course, the response time of user experience includes personal subjective factors and objective response time. When designing software, we need to consider how to better Combine these two parts to achieve the best user experience. For example, when a user queries a large amount of data, we can display the extracted data to the user, and continue to retrieve data while the user is viewing it. At this time, the user does not know what we are doing in the background.

What the user cares about is the corresponding time of the user's operation.

Secondly, we consider the performance points that need attention from the perspective of administrators.

1. Response time

2. Is the server resource usage reasonable?

3. Whether the use of application server and database resources is reasonable

4. Can the system be expanded?

5. What is the maximum number of user visits supported by the system, and what is the maximum business processing capacity of the system?

6. Where are the possible bottlenecks in system performance?

7. Replacing those devices can improve performance

8. Can the system support 7×24 hours of business access

Again, consider it from the perspective of developers (designers).

1. Is the architecture design reasonable?

2. Is the database design reasonable?

3. Is there any performance problem in the code?

4. Is there any unreasonable memory usage in the system?

5. Is there any unreasonable thread synchronization method in the system?

6. Is there any unreasonable resource competition in the system?

Guess you like

Origin blog.csdn.net/hdxx2022/article/details/129778797