Do you want to build a website that can withstand 5 million PVS/day? What about computing?

Source: Internet
Author: User

Do you want to build a website that can withstand 5 million PVS/day? What is PV 5 million? How many requests can be processed by the server per second? What about computing?

What is PV:

PV is short for page view. PV refers to the number of page visits. Each time a page is opened or refreshed, a PV is created.

Computing Model:
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 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 a day (suitable for Internet applications, with many requests during the day and few requests at night ).

 

Simple Calculation Result:
(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 conclusion: 
Now we have a standard for stress testing. If your server can process 115.7 requests in one second, it will be able to withstand 5 million PVS/day. If your server can process 23.1 requests in one second, it can withstand 1 million PVS/day.

 

Remaining amount:

The above requests are evenly distributed in the 9.6 hours of the day, but the actual situation is not so even, there will be a low peak. In order to cope with the peak hours, we should leave some room, at least X2 times, And X3 times.

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

 

Conclusion:

If your server can process 231.4-347.1 requests per second, you can handle an average of 5 million PVS per day.

If your server can process 46.2-69.3 requests per second, you can handle an average of 1 million PVS per day.

 

Note:

N requests per second, that is, QPS. Because I care about the application's ability to process business.

 

Practical experience:

1. Based on actual experience, two rack servers with regular configurations are used. configuration is a common configuration, such as a 4-core CPU + 4G memory + server SAS hard disk.

2. I personally think that Intel's CPU in the server CPU field is better than AMD's CPU. If there is any objection, I will say that I am so arrogant (please refer to the CPU performance comparison ), do not trust AMD's advertisement too much. A simple way to compare CPU performance is to compare the price. Do not compare the frequency with the number of cores, and the price is similar to the performance.

3. Hard Disk performance is very important because it is a database server. Generally, servers are equipped with 15 thousand-to-SAS hard drives. Advanced servers can be equipped with SSD solid state drives, providing better performance. The most important indicator is "random read/write performance" rather than "sequential read/write performance ". (In this example, configure the most common 15 thousand-to-SAS hard drive)

4. One server runs tomcat to run the J2EE program, one server runs the MySQL database, and the program write level is moderate (this 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 ).

5. In the above software and hardware scenarios, it can withstand 1 million PVS/day. (There is a margin to deal with sudden access peaks)

 

Note the network bandwidth of the IDC:

Some people say that I have met all the above conditions, but the actual performance still fails to reach the goal. At this time, please pay attention to your external network bandwidth. In China, the server is cheap but the bandwidth is very expensive. It is very likely that you share a m optical fiber with everyone in the data center. In fact, each person can allocate about 2 m of bandwidth. A little better 5 m, a little better two-line data center 10 m exclusive, this is already very expensive (Beijing price ).

Total traffic per day: 20 K bytes per page x 1 million pages/1024 = 19531m bytes = 19g bytes,

19531 M/9.6 hours = 2034 M/hour = 578k Bytes/s if the request is evenly distributed, 5 m (640k bytes) bandwidth (5 MB = 640kb
Note the case sensitivity. B is a bit, B is a byte, and the difference is 8 times. However, it is impossible for all requests to be evenly distributed. When there is a high peak, 5 mbps bandwidth is not enough, and X2 is 10 mbps bandwidth. 10 mbps bandwidth can basically meet the requirements.

The above is assumed that each page is 20 K bytes, basically does not contain images, if the picture is larger, 10 M bandwidth cannot meet the requirements. You can calculate it yourself.

(Full text)

 

 

 

Appendix: basic concepts of Performance Testing
Bytes ---------------------------------------------------------------------------------------
Basic concepts: 
Throughput (throughput): According to the general understanding, network throughput indicates the sum of the data volumes that pass through the network adapter per unit time. This includes the data volumes sent from the local network adapter and the data volumes received by the local network adapter. A 100 MB (BIT) duplex Nic, the maximum data transmission speed is 12.5m Bytes/s, the maximum data receiving speed is 12.5m Bytes/s, canSimultaneous sending and receivingData.
Number of concurrent users: the number of concurrent users ).
Response time: the time it takes to send a request to receive a response.


QPS-queries per second number of queries processed per second (if it is a database, it is equivalent to reading)
TPS-transactions per second number of transactions processed per second (if it is a database, it is equivalent to writing and modifying)
Iops, disk I/O operations per second

For example, two separate QPS and TPS tests are performed for a database.
The QPS (read) value is always higher than TPS (write, modify), and there is a rate relationship, because:
1. The database may cache queries.
2. reading from a mechanical or SSD hard disk is faster than writing.
Bytes ---------------------------------------------------------------------------------------
Jmeter test parameters: 

# Samples: the total number of requests sent by a test unit.

Average: average response time-the average response time of a single request by default. When transaction controller is used, the average response time can also be displayed in the unit of transaction ., Not important.

Median: Median, that is, the response time of 50% users. If the response time is sorted in ascending order, 50% of the request response time is within this range. Important.

90% line: 90% user response time. If the response time is sorted in ascending order, 90% of the request response time is within this range. Important.

Min: minimum response time, not important.

MAX: Maximum response time. The probability of occurrence is only 1‰ or even one thousandth of a day, which is not important.

Error %: Number of requests with errors in this test

Throughput: Throughput-by default, it indicates the number of requests completed per second (request per second). When transaction controller is used, it can also represent the number of transactions per second similar to LoadRunner.

KB/sec: the amount of data received from the server per second (only received), equivalent to throughput/sec in LoadRunner
Bytes ---------------------------------------------------------------------------------------
LoadRunner test parameter description: 

Response time:Take the 90% value. If the response time is sorted in ascending order, the response time of the 90% request 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, the number of transactions per second. A transaction refers to the process in which a client sends a request to the server and then the server responds.

Throughput (throughput ):The throughput of the LoadRunner record is the sum of all bytes received by the server and is irrelevant to the number of locally sent bytes.

Throughput/sec:Throughput per second.

For BS architecture, the general analysis response time, click rate, throughput, TPS (transactions per second ).
General analysis TPS for CS architecture (transactions per second)

Bytes ---------------------------------------------------------------------------------------
Description of Apache AB test parameters: 

RPS:Request per second, number of requests processed per second
For details, see:

Http://blog.chinaunix.net/u3/108043/showart_2260477.html

Address: http://elf8848.iteye.com/blog/967049

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.