Do you want to build a website that can withstand 5 million pv/a day? How many requests should the server handle per second?

Source: Internet
Author: User

Do you want to build a website that can withstand 5 million pv/a day? How many requests should the server handle per second?

Do you want to build a website that can withstand 5 million pv/a day? What is the concept of 5 million PV? How many requests should the server handle per second? What if it's calculated?

What PV is:

PV is a shorthand for page view. PV refers to the number of pages visited, every time you open or refresh a page, even if you do a PV.

Calculation model:

The number of requests processed per second by each server = ((80%* total PV)/(24 hours *60 *60 seconds *40%)/number of servers.
The key parameters are 80%, 40%. Indicates that 80% of the requests in a day occur within 40% of a day. The 24-hour 40% is 9.6 hours, and 80% of the requests occur within 9.6 hours of the day (very suitable for Internet applications, more requests during the day, and fewer requests at night).

The result of a simple calculation:

((80%*500 million)/(24 hours *60 minutes *60 seconds *40%))/1 = 115.7 Requests/sec
((80%*100 million)/(24 hours *60 minutes *60 seconds *40%))/1 = 23.1 Requests/sec

Preliminary Conclusions:
Now that we have a stress test, we have the standard, if your server can handle 115.7 requests a second, you can withstand 5 million pv/per day. If your server can handle 23.1 requests a second, you can withstand 1 million pv/a day.

Sufficient margin:

The above request number is evenly distributed in the daytime 9.6 hours, but the actual situation is not so evenly distributed, there will be peaks and troughs. In order to cope with rush hour, should leave some leeway, at least also must x2 times, X3 times also not too.

115.7 Requests/sec * twice times = 231.4 Requests/second

115.7 Requests/sec * 3 times times = 347.1 Requests/second

23.1 Requests/sec * twice times = 46.2 Requests/second

23.1 Requests/sec * 3 times times = 69.3 Requests/second

Final conclusion:

If your server can handle 231.4--347.1 Requests/sec in a second, you can deal with an average of 5 million pv/per day.

If your server can handle 46.2--69.3 requests in a second, you can deal with an average of 1 million pv/per day.

Description

This shows n requests per second, which is a QPS. Because I care about the ability of the application to handle the business.

Practical experience:

1, according to the actual experience, the use of two conventional rack-mounted servers, configuration is very common configuration, such as a 4-core cpu+4g memory + server SAS hard disk.

2, the individual arbitrary think in the server CPU domain Intel CPU is superior to AMD CPU, there are objections to it, I said I was arbitrary (see CPU performance comparison), do not believe too much of AMD ads, compare CPU performance simple way is more than the price, not more than the frequency and core number, The price difference is not much performance also difference.

3, the performance of the hard disk is very important, by it is the database server. The general server is equipped with 15,000 RPM SAS hard drive, the advanced point can be equipped with SSD SSD, performance will be better. The most important indicator is "random Read and write performance" rather than "sequential read and write performance". (In this case, configure the most common 15,000-rpm SAS hard drive.)

4, a server running Tomcat run the Java program, a server running MySQL database, the program write medium level (this really bad quantification), is the forum type of application (always have replies, not too easy to do cache, also can not be static).

5, the above hardware and software cases, is able to withstand 1 million pv/per day. (has been left to cope with sudden peak traffic)

Pay attention to the network bandwidth of the room:

Some people say that I am satisfied with the above conditions, but the actual performance is still not reach the goal. At this point please pay attention to your external network bandwidth, in the domestic server cheap but the bandwidth is very expensive, it is likely that you are in the computer room with everyone sharing a 100M fiber, the actual individual can be divided into 2M bandwidth. A little better 5M, and a little bit of double-line room 10M Exclusive, this is already very expensive (Beijing price).

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

19531m/9.6 hours =2034m/hours =578k Bytes/s If the request is evenly distributed, 5M (640K bytes) of bandwidth is required (5mb=640kb note case, B is bit, B is byte, 8 times times worse), but all requests cannot be evenly distributed, When there is a peak 5M bandwidth must not be enough, X2 times is 10M bandwidth. 10M bandwidth can basically meet the requirements.

The above is assumed that each page 20k bytes, basically does not include the picture, if the inclusion of the picture is larger, 10M bandwidth can not meet the requirements. You calculate it yourself.

(End of full text)

Do you want to build a website that can withstand 5 million pv/a day? How many requests should the server handle per second?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.