What kind of server does a website with daily visits of 10,000 ip need?

A question that novice webmasters can’t avoid is what kind of server to configure for their own website? How can we rent the most suitable server with the least cost? Today, our topic is mainly to talk about this issue that webmasters cannot avoid. How do you calculate what kind of configuration server to rent based on the number of website visits and concurrency? For example, if your website has 50,000 PVs per day, what kind of configuration does your server need to handle the 50,000 PV requests? We need How to calculate?

Before solving this problem, it is necessary for the editor to popularize these terms with you:

1) What is PV?

PV is short for page view. PV refers to the number of visits to a page. Every time a page is opened or refreshed, it is considered as a PV.

2) What is throughput (Throughput)?

According to the conventional understanding, the network throughput means the sum of the amount of data passing through the network card within a unit of 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, the maximum sending data speed is 12.5M bytes/s, the maximum receiving data speed is 12.5M bytes/s, and can send and receive data at the same time.

3) What is the number of concurrent users?

That is, users (number of threads) performing operations at the same time.

4) What is response time?

That is, the time it takes from sending a request to receiving a response.

5) What is QPS?

The full name of QPS is Queries Per Second, which refers to the number of queries processed per second (if it is a database, it is equivalent to reading)

6) What is TPS?

The full name of TPS is Transactions Per Second, which refers to the number of transactions processed per second (if it is a database, it is equivalent to writing and modifying)

7) What is IOPS?

That is, the number of I/O operations performed by the disk per second.

Computational model

The number of requests processed by each server per second = ((80%*total PV)/(24 hours*60 minutes*60 seconds*40%))/number of servers.

The key parameters are 80% and 40%. It means that 80% of the requests in a day occur in 40% of the time in a day. 40% of 24 hours is 9.6 hours, and 80% of the requests occur in 9.6 hours a day (very suitable for Internet applications, there are many requests during the day and few requests at night).

The result of a simple calculation

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

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

Preliminary Conclusions

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

Reserve enough margin to deal with unexpected events

The above number of requests is evenly distributed in the 9.6 hours of the day, but the actual situation is not so evenly distributed, there will be peaks and troughs. In order to cope with peak hours, some leeway should be left, at least x2 times, x3 times is not too much.

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

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

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

23.1 requests/second*3 times=69.3 requests/second

final conclusion

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

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

(Note: N requests per second here is QPS. Because I care about the ability of the application to process business.)

bandwidth budget

Combined with the bandwidth requirements of your external network, for example, the domestic server is cheap but the bandwidth is very expensive. It is likely that you share a 100M optical fiber with everyone in the computer room, and each person can actually get about 2M bandwidth. Even better, 5M, and even better, the exclusive market price of 10M in a two-line computer room is generally around 600RMB, which is not cheap anymore.

Total traffic per day: 20k bytes per page * 1 million pages/1024=19531M bytes=19G bytes, 19531M/9.6 hours=2034M/hour=578K bytes/s, if requests are evenly distributed, 5M is required (640K bytes) bandwidth (5Mb=640KB pay attention to capitalization, b is bit, B is byte, the difference is 8 times), but all requests cannot be evenly distributed, when there is a peak, 5M bandwidth must not be enough, X2 times It is 10M bandwidth. 10M bandwidth can basically meet the requirements.

The above is assuming that each page is 20k bytes, and basically does not contain pictures. If it contains pictures, it will be larger, and the 10M bandwidth cannot meet the requirements. Therefore, how to configure the rented server cannot be applied mechanically. It needs to be combined with the actual situation of your own site to make a total estimate.

Finally, configure the CPU, memory, bandwidth, hard disk, and lines based on actual needs and past operating experience. Remember not to apply it mechanically, but to be flexible according to the actual operation of the website. You can also contact the editor to customize it for you alone~

Guess you like

Origin blog.csdn.net/evening__breeze/article/details/128776802