When a blog is developed into a well-known blog, blog access is usually very large, using the use of virtual host, personal blog due to the large number of visits often will cause server performance problems, this is a lot of people's troubles, someone used to cancel RSS and other wrong way to solve the problem, is clearly the wrong medicine, So for the site to bring the problem of large traffic, the correct way to solve it? The following is my personal summary of some of the experience for your reference.
First, verify that the server hardware is sufficient to support the current traffic.
Ordinary P4 servers generally support up to 100,000 independent IP per day, if the traffic is larger than this, then you must first configure a more high-performance dedicated server to solve the problem, otherwise how optimization can not completely solve performance problems.
Second, optimize database access.
The server load is too large, an important reason is that the CPU load is too large, reduce the server CPU load, can effectively break the bottleneck. The use of static pages can minimize the load on the CPU. The foreground realizes completely static of course best, can not access the database completely, but for frequently updated website, static often cannot satisfy certain function.
Caching technology is another solution, which is to store dynamic data in cached files, which are called directly by Dynamic Web pages without having to access the database, and both WordPress and Z-blog Use this caching technique heavily. I have also written a z-blog counter plug-in, also based on this principle.
If you do not avoid access to the database, you can try to optimize query SQL for the database. Avoid statements such as SELECT * from, where each query returns only the results that you want, avoiding a large number of SQL queries over a short period of time.
Third, the prohibition of external hotlinking.
External Web site pictures or file hotlinking often bring a lot of load pressure, so should strictly limit the external to their own picture or file hotlinking, fortunately at present can simply through the refer to control hotlinking, Apache itself can be configured to prohibit hotlinking, IIS also has Third-party ISAPI implementations that can do the same. Of course, the forgery of refer can also be implemented through the code to hotlinking, but the current deliberate falsification of refer hotlinking is not much, you can not consider, or use of technical means to solve, such as in the image to add watermark.
Four, control the download of large files.
Large file downloads can take up a lot of traffic, and for non-SCSI hard drives, a large number of file downloads consume CPU, making the site less responsive. Therefore, try not to provide more than 2M of large file downloads, if you need to provide, it is recommended to put large files on another server. There are a number of free Web 2.0 sites that offer photo sharing and file sharing, so try to upload images and files to these sharing sites.
V, the main flow of the use of different mainframe streaming
Put the files on a different host, providing different mirrors for the user to download. For example, if you feel that RSS files occupy a large amount of traffic, then use FeedBurner or Feedsky and other services to the RSS output on other hosts, so that other people access to the flow of pressure is mostly concentrated in the FeedBurner host, RSS does not occupy too much resources.
Use the flow analysis statistics software.
Install a traffic analysis and statistics software on the website, you can know immediately which place consumes a lot of traffic, which pages need to be optimized again, therefore, solve the traffic problem still need to carry on accurate statistic analysis to be able. The Flow analysis Statistics software I recommend is Google Analytics (Google Analytics). I use the process to feel the effect is very good, later I will give a detailed introduction to Google Analytics Some of the use of common sense and skills.