First, configure a high-performance server

A typical P4 server can support up to 100,000 unique IP addresses per day. If the traffic volume is higher than that, you must first configure a dedicated server with higher performance to solve the problem, otherwise no amount of optimization can completely solve the performance problem.

Second, optimize database access.

It would be nice if the front desk were completely static and didn’t have to access the database at all, but for frequently updated sites,


Statically, some functionality is often inadequate.

Caching technology is another solution, where dynamic data is stored in cached files and called directly by dynamic web pages


These files, instead of having to access the database, are used extensively by both WordPress and Z-blog. I


I also wrote a counter plug-in for Z-blog based on this principle.

If you really cannot avoid database access, you can try to optimize the query SQL for the database. Avoid the use of


The Select * from statement returns only the required results each time, avoiding large numbers in a short time


Volume SQL queries.

Third, prohibit external leeching.

Image or file theft from external websites can cause a lot of load, so external pairs should be strictly limited


In its own picture or file theft, fortunately, you can simply control theft through the refer, Apache from


You can already configure it to disable it, and IIS also has some third-party ISapis that do the same. when


However, forged refer can also be realized by code, but there are not many deliberate forged refer chains at present.


It can be ignored or solved by non-technical means, such as adding watermarks to images.

Fourth, control the download of large files.

Large file downloads consume a lot of traffic, and for non-SCSI hard disks, large file downloads consume


CPU, so that the web site response capacity decline. Therefore, try not to provide large file downloads larger than 2M if needed


It is recommended that large files be placed on a different server.

Fifth, use different hosts to divert the main flow

Put the files on different hosts and provide different images for users to download. For example, if you feel that an RSS file is taking up


If traffic is high, use a service like FeedBurner or FeedSky to put RSS output on another host


Most of the traffic is on the FeedBurner host, so RSS doesn’t take up too much resources.

Sixth, use traffic analysis statistics software.

Install a traffic analysis software on your website to instantly know which pages and places are consuming the most traffic


Surface needs to be optimized again, therefore, to solve the flow problem also needs to carry out accurate statistical analysis. I recommend that


The traffic analysis software used is Google Analytics. I feel it when I use it


The results are pretty good, and I’ll go over some common sense and techniques for using Google Analytics later.