Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to calculate how much PV the server can withstand

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how to calculate how much PV the server can withstand. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

Do you want to build a website that can withstand 5 million PV/ per day? what is the concept of 5 million PV? How many requests does the server have to process per second to respond? What about the calculation?

What is PV:

PV is the abbreviation of page view. PV refers to the number of visits to the page, each time the page is opened or refreshed, it is considered to be a pv.

Calculation model:

Number of requests processed per second per server = ((80% total PV) / (24 hours, 60 minutes, 60 seconds) / number of servers.

The key parameters are 80% and 40%. Indicates that 80% of requests occur within 40% of the day. 40% of 24 hours is 9.6 hours, and 80% of requests occur in 9.6 hours of the day (very suitable for Internet applications, with more requests during the day and fewer requests at night).

The result of a simple calculation:

((80% 5 million) / (24 hours 60 minutes 60 seconds 40%) / 1 = 115.7 requests / second

((8 million) / (24 hours, 60 minutes, 60 seconds) / 1 = 23.1 requests per second

Preliminary conclusion:

Now when we do stress tests, we have a standard. If your server can handle 115.7 requests a second, it can withstand 5 million PV/ per day. If your server can handle 23. 1 requests per second, it can handle 1 million PV/ per day.

Leave enough allowance:

The above requests are evenly distributed during the 9.6 hours of the day, but the actual situation will not be so evenly distributed, there will be peaks and troughs. In order to cope with the rush hour, we should leave some leeway, at least x2 times, x3 times is not too much.

115.7 requests / second * 2x = 231.4 requests / second

115.7 requests / second * 3x = 347.1 requests / second

23.1 requests / second * 2x = 46.2 requests / second

23.1 requests / sec 3x = 69.3 requests / sec

Final conclusion:

If your server can handle 231.4 UV 347.1 requests per second, it can handle an average of 5 million PV / day.

If your server can handle 46.2 Murray 69.3 requests per second, you can handle an average of 1 million PV / day.

Description:

Here is N requests per second, which is QPS. Because what I care about is the ability of the application to handle business.

Practical experience:

1. According to practical experience, using two rack servers with conventional configuration, configuration is a very common configuration, such as a 4-core CPU+4G memory + server SAS hard disk.

2. The performance of the hard disk is very important, because it is the database server. General servers are equipped with 15000 revolutions of SAS hard drives, advanced ones can be equipped with SSD solid state drives, the performance will be better. The most important indicator is "random read-write performance" rather than "sequential read-write performance". (this example is to configure the most common 15000-speed SAS hard drive.)

3. A server runs Tomcat to run j2ee programs, and a server runs MySql databases. The program is written at a medium level (which is really difficult to quantify). It is a forum-type application (there are always replies, it is not easy to cache and cannot be static).

4. Under the above hardware and software, it can withstand 1 million PV/ per day. (there is room to cope with the sudden peak of visits)

Pay attention to the network bandwidth of the computer room:

Some people say that I have met all the above conditions, but the actual performance still falls short of the goal. At this time, please pay attention to the bandwidth of your external network, the domestic server is cheap but the bandwidth is very expensive, it is very likely that you share a 100m optical fiber with everyone in the computer room, in fact, everyone can get about 2m bandwidth. A little better 5m, a little better dual-line computer room 10m exclusive, this is already very expensive (Beijing price).

Total daily traffic: 20k bytes per page 1 million pages / 1024million 19531m bytes = 19g bytes

19531M/9.6 hours = 2034M/ hours = 578K bytes / s if requests are evenly distributed, 5m (640K bytes) bandwidth is required (5Mb=640KB pay attention to case, b is bit, B is byte, 8 times the difference), but all requests cannot be evenly distributed. When there is a peak, 5m bandwidth is not enough, X2x is 10m bandwidth. The 10m bandwidth can basically meet the requirements.

The above is assumed that each page 20k bytes, basically does not contain pictures, if the picture is even larger, 10m bandwidth can not meet the requirements. Do the math yourself.

Attached: basic concepts of performance testing

Basic concepts:

Throughput (throughput): according to the conventional understanding, network throughput represents the sum of the amount of data sent through the network card in a unit time, including the amount of data sent by the local network card and the amount of data received by the local network card. A 100Mb (bit) duplex network card can send data at a speed of 12.5m bytes / s and receive data at a speed of 12.5m bytes / s, which can send and receive data at the same time.

Number of concurrent users: the number of users (threads) who perform operations at the same time.

Response time: the time taken from the time the request was sent to the time the response was received.

The number of queries processed by QPS-Queries Per Second per second (in the case of a database, equivalent to reading)

The number of transactions processed by TPS-Transactions Per Second per second (in the case of a database, it is equivalent to writing and modifying)

IOPS, the number of iUniverse operations performed by the disk per second

For example, to test a database, test QPS and TPS separately.

The value of QPS (read) is always higher than that of TPS (write, modify) and has a multiplier relationship because:

1. The database may have a cache for queries.

2. Mechanical hard disk or SSD hard disk is faster to read than write.

Description of JMeter test parameters:

Label: the name of each test unit.

Samples: indicates how many requests have been made by a test unit.

Average: average response time-by default, it is the average response time of a single Request, and when Transaction Controller is used, it can also be displayed in Transaction units. Oh, it doesn't matter.

Median: the median, that is, the response time of 50% of users. If the response time is sorted from smallest to largest, the response time of 50% of requests is within this range. important.

The response time of 90% Line:90% users. If the response time is sorted from smallest to largest, then 90% of the requests have response time within this range. It's important.

Min: minimum response time, not important.

Max:*** response time, the probability of occurrence is only 1/1000 or even 1/10000, it doesn't matter.

Error%: the number of requests with errors in this test

Throughput: throughput-by default, the number of requests completed per second (Request per Second). When Transaction Controller is used, it can also represent the number of Transaction per Second similar to LoadRunner.

KB/Sec: the amount of data received from the server per second (just received), equivalent to the Throughput/Sec in LoadRunner

Description of loadrunner test parameters:

Response time: take a value of 90%. If you sort the response time from minimum to large, then 90% of the requests' response time is within this range. important.

Clicks per second: hits per Second, the number of requests submitted to the server per second.

TPS: Transaction per Second, transactions per second. A transaction is the process in which a client sends a request to the server and the server reacts.

Throughput (throughput): the Throughput recorded by Loadrunner is the sum of all the bytes returned by the server, regardless of the number of bytes emitted locally.

Throughput/Sec: throughput per second.

General analysis of BS architecture response time, click rate, throughput, TPS (transactions per second).

General analysis of CS architecture TPS (transactions per second)

The above is how to calculate how much PV the server can bear. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report