Build a website that can withstand 5 million pv/per day if calculated?

Source: Internet
Author: User

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)

Attached: Basic concepts of performance testing
---------------------------------------------------------------------------------------
Basic Concepts:
Throughput (throughput): According to the general understanding of network throughput represents the sum of the amount of data in a unit of time through the network card, which includes the amount of data sent by the local network card also includes the amount of data received by the native NIC. A 100Mb (bit) duplex network card, the maximum transmit data speed is 12.5M bytes/s, the maximum received data speed is 12.5M bytes/s, you can send and receive data at the same time .
Concurrent users: The number of users (threads) that are performing the operation concurrently.
Response time: The time it took to send the response from the request to the receipt.


Qps-queries per Second number of queries processed/sec (equivalent to read in the case of a database)
Tps-transactions per Second transactions (equivalent to write, modify, if database)
IOPS, number of I/O operations per second of disk

For example, for a database test, two times the QPS and TPS are separately measured.
The QPS (read) value is always higher than the TPS (write, change), and has a magnification relationship because:
1. The database may have a cache for queries.
2, mechanical hard disk or SSD hard disk reading is faster than writing.
---------------------------------------------------------------------------------------
jmeter Test parameter description:

Label: The name of each test unit.

#Samples: Indicates how many requests a test unit has made.

Average: Average response time--By default is the average response time for a single Request, and when Transaction Controller is used, the average response time can also be displayed in Transaction units. , not important.

Median: The median, which is the response time of 50% users, if the response time is sorted from small to large, then 50% of the response time of the request is within this range. Important.

90% line:90% The response time of the user, if the response time is sorted from small to large, then 90% of the response time of the request is within this range. Important.

Min: Minimum response time, not important.

Max: The maximum response time, the chance is only 1 per thousand or even one out of 10,000, not important.

error%: Number of requests that have errors in this test

Throughput: Throughput--By default, the number of requests completed per second (request per Second), when Transaction Controller is used, can also represent LoadRunner-like Transaction per Number of Second

Kb/sec: The amount of data received per second from the server (just received), equivalent to throughput/sec in LoadRunner
---------------------------------------------------------------------------------------
LoadRunner Test parameter description:

Response Time:Take 90% value, if the response time from small to large order, then 90% of the response time of the request within this range. Important.

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

TPS:Transaction per Second, transaction count, a transaction is the process by which a client sends a request to the server and the server responds

throughput (throughput):The throughput of the LoadRunner record is the sum of all bytes received by the server, regardless of the number of bytes emitted locally.

throughput/sec:Throughput per second.

General analysis Response time, CTR, throughput, TPS (number of transactions per second) for BS architectures.
General analysis of the CS Architecture TPS (number of transactions per second)

---------------------------------------------------------------------------------------
Apache AB Test parameter description:

RPS:Request per Second, number of requests processed per second

Build a website that can withstand 5 million pv/per day if calculated?

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.