当前位置:网站首页>QPS, TPS, concurrent users, throughput relationship

QPS, TPS, concurrent users, throughput relationship

2022-06-24 08:28:00 Common_ youmen

QPS

QPS Is the query rate per second , Is the number of queries per second on a server , It is a measure of how much traffic a specific query server handles in a given period of time , That is, the number of response requests per second , That is, the maximum throughput capacity ;

TPS

TPS Is the number of transactions / second , A transaction is a process in which a client sends a request to the server and the server responds , The client starts timing when it sends the request , End timing after receiving server response , This is used to calculate the time used and the number of transactions completed ;

QPS and TPS difference

1 . TPS That is, the number of transactions per second , It includes

1 . User requests server

2 . Server's own internal processing

3 . The server returns to the user

These three processes , Can complete every second N These three processes ,TPS Namely N;

2 . QPS Be similar to TPS, But here's the difference , A visit to a page , To form a TPS, But a page request , Multiple server requests may occur , The server requests for these , You can count in "QPS" In ;

Example

Visit a page request server 3 Time , Produce a "T",3 individual "Q"

A big stomach King eats in a second 10 A steamed bun , A girl 0.1 Eat a steamed bun every second , So are they the same ?

The answer is No , Because this girl can't eat it in a second 10 A steamed bun , She may have to eat for a long time . At this time, this big stomach king is equivalent to TPS, And this girl is QPS. Although very similar , But it's different .

Concurrency number ( Concurrency )

It refers to the number of requests that can be processed by the system at the same time , At the same time, it reflects the load capacity of the system , This number can analyze machines 1s The number of internal access logs ;

throughput

throughput

Throughput refers to the number of requests processed by the system in unit time ,TPS,QPS They are all commonly used quantitative indicators of throughput ;

System throughput elements

The throughput of a system ( Bearing capacity ) And request( request ) Yes cpu Consumption of , External interface ,IO And so on .

Single request Yes cpu The higher the consumption , External system interface ,IO The slower the impact , Lower system throughput , Vice versa .

Important parameter

QPS(TPS), Concurrency number , response time

1 . QPS(TPS): Every second request/ Business Number

2 . Concurrency number : System processing at the same time request/ Transactional number

3 . response time : Generally, the average response time is taken

Relationship

QPS(TPS)= Concurrency number / Mean response time

The throughput of a system usually has QPS(TPS), There are two factors that determine , Each system has a relative limit value for these two values , Under the pressure of application scenario access , As long as one item reaches the highest value in the system , The system throughput can't go up , If the pressure continues to build , The throughput of the system will decrease , The reason is that the system is overloaded , Context switch , Memory and other consumption lead to system performance degradation .

PV

Page visits , Page views or clicks , Every time the user refreshes it is calculated once , You can count the access log of the service for one day to get ;

UV

Independent visitor , Statistics 1 Number of users visiting a site in days , You can count the access logs of the server for one day and get the information according to the unique ID of the user , response time (RT):

Response time refers to the time when the system responds to the request , Generally, the average response time is taken , Can pass Nginx,Apache And so on. Web Server obtain ;

DAV

Number of daily active users , Often used to reflect websites , Operation of Internet applications or online games , DAU Usually count one day ( Statistics Day ) within , Number of users logged in or using a product ( Remove the duplicate login user ), And UV The concept is similar

MAU

Number of monthly active users , The website ,app Number of active users in the month after de duplication ;

System throughput evaluation

When we do system design, we need to consider CPU operation ,IO, The influence of external system response factors and the preliminary estimation of system performance ;

And usually , We face the need , We evaluated it out of QPS, In addition to concurrency , There's another dimension : Japan pv.

By observing the access log of the system, we find that , In the case of a large number of users , The access traffic of the same time period in each time period is almost the same . Like every morning on weekdays . As long as you can get the daily flow chart and QPS We can calculate the daily flow .

General technical methods

1 . Find the top of the system TPS And Japan PV, There is a relatively stable relationship between these two elements ( Except for holidays 、 Besides the influence of seasonal factors )

2 . Predict through stress testing or experience , Get the highest TPS, Then follow up 1 The relationship between , Calculate the maximum daily throughput of the system .B2B Chinese and Taobao are facing different customer groups , The network behavior of these two customer groups should not be used , Between them TPS and PV The relationship ratio is also different .

Software performance concerns

What kind of performance should we pay attention to when we do performance testing

First , The purpose of developing software is to let users use , Let's first analyze it from the perspective of users , What features do users need to focus on .

For users , When you click a button 、 Link or issue a command to start , Until the system displays the results in the form of user perception , The time consumed in this process is the user's visual impression of the software's performance like . That's what we call response time , When the corresponding time is small , The user experience is great , Of course, the response time of user experience includes personal subjective factors and objective response time , When designing software , We just need Consider how to better combine these two parts to achieve the best user experience . Such as : When the user queries in large amount of data , We can show the data extracted first to users , Continue to check the data while the user is watching Cable , At this time, users don't know what we are doing in the background .

Users are concerned about the response time of user actions

Consider the performance points from the administrator's point of view

1 . response time 2 . Is the server resource usage reasonable 3 . Whether application server and database resources are used reasonably

4 . Can the system be extended 5 . How many users can access the system at most 、 What is the maximum business processing capacity of the system 6 . What 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

Development ( Design ) From the personnel point of view

1 . Is the architecture design reasonable

2 . Is the database design reasonable

3 . Is there a performance problem with the code

4 . Is there any unreasonable memory usage in the system

5 . Whether there is an unreasonable thread synchronization mode in the system

6 . Whether there is unreasonable resource competition in the system

原网站

版权声明
本文为[Common_ youmen]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/06/20210625145709946l.html