Performance test model (PV calculation model)

PV (Visits): Page View, that is, page views or clicks, the user is counted once every refresh.
UV (Independent Visitor): Unique Visitor, a computer client that visits your website is a visitor. The same client is counted only once between 00: 00-24: 00.
IP (Independent IP): Internet Protocol, refers to the number of independent IP. The same IP address is counted once from 00: 00-24: 00
 
Question: The average daily PV of a system is 8000, so what should the number of concurrent users be?
 
1. First of all, I think we should investigate what the business of this system is and what is the correlation between each. Where are these PVs distributed?
2. If these PVs are a single service, then depending on the user's operation in the foreground, several requests will be made to the server. Because if the web page contains pictures, js and other content, the user opens the operation at a time, it will generate multiple operations on the server.
3. We assume that a user's operation in the foreground will only generate pv once. The number of concurrent users refers to how many users access the server at the same time.
   In this regard, I assume three access conditions:
     (1) worst case: 8000 users initiate requests at the same time, then the number of concurrent users should be 8000
     (2) best case: 8000 users initiate requests evenly in time, Then the number of concurrent users is 8000/24 ​​* 60 * 60 = 0.093, which is equivalent to 5.5 requests in one minute, basically there is no concurrency, just a single execution.
     (3) 80 ~ 20 principle: But in real life, the probability of the above two situations is very small. According to the principle of statistics, the number of concurrent users is calculated using the principle of 80 ~ 20, 8000 * 0.8 / (8 * 60 * 60 * 0.2) = 1.11, that is, two users per second are concurrent.

Follow-up: Why are there many users per second, not every hour, every minute, every millisecond?
 
Answer: I am working on a project with 120 concurrent queries, with a minimum response time of 0.047s, a maximum of 6.216s, and an average of 0.779s. A business interaction with the server takes about 1 second. Personally, the time span is too long in units of hours and minutes; the time span is too short in units of milliseconds. In summary, the unit of seconds is more appropriate.

4. After lr uses the rendezvous point, in each iteration, all (or part) requests must be answered before the next iteration is initiated. Therefore, we only sent one concurrent request during the iteration cycle. The number of concurrent users we calculated based on the 80 ~ 20 principle must be multiplied by this iteration cycle. (For example, in my query project, the iteration period is about 9 seconds, so the number of concurrent users is 1.11 * 9 = 9.99, and finally the number of concurrent users is 10)

 

PV calculation model

The existing PV calculation formula is: average PV per second per server = ((total PV * 80%) / (24 * 60 * 60 * 40%)) / number of servers = 2 * (total PV) / * ( 24 * 60 * 60) / Number of servers

 

 

 

Find the area of ​​the entire distribution graph by definite integration, and then find the definite integration in the range around the highest value, you can find the total time that takes 80% of the pv amount. Based on this data, the formula for calculating pv becomes:

Average PV volume per server per second = ((80% * total PV) / (24 * 60 * 60 * (9/24))) / number of servers

That is, the average PV per second per server = 2.14 * (total PV) / * (24 * 60 * 60) / number of servers

Furthermore, it can be concluded that the pv amount of the highest peak is 1.29 times the average pv value.

According to the actual situation, calculate the time T, and then calculate the PV amount = ((80% * total PV) / (24 * 60 * 60 * (T / 24))) / number of servers

The existing PV calculation formula is: average PV per second per server = ((total PV * 80%) / (24 * 60 * 60 * 40%)) / number of servers = 2 * (total PV) / * ( 24 * 60 * 60) / Number of servers

 

 

 

Find the area of ​​the entire distribution graph by definite integration, and then find the definite integration in the range around the highest value, you can find the total time that takes 80% of the pv amount. Based on this data, the formula for calculating pv becomes:

Average PV volume per server per second = ((80% * total PV) / (24 * 60 * 60 * (9/24))) / number of servers

That is, the average PV per second per server = 2.14 * (total PV) / * (24 * 60 * 60) / number of servers

Furthermore, it can be concluded that the pv amount of the highest peak is 1.29 times the average pv value.

According to the actual situation, calculate the time T, and then calculate the PV amount = ((80% * total PV) / (24 * 60 * 60 * (T / 24))) / number of servers

Guess you like

Origin www.cnblogs.com/douyini/p/12753819.html