How to resolve web traffic, high concurrency problems

Source: Internet
Author: User
Tags dedicated server

For today's large-volume web site, tens of millions of or even billions of traffic per day, how to solve the problem of access volume?

Here are some summary methods: First, verify that the server hardware is sufficient to support current traffic. Ordinary P4 server can generally support up to 100,000 independent IPs per day, if the traffic is larger than this, then you must first configure a more high-performance dedicated server to solve the problem, or how optimization can not completely solve the performance problem.

Second, optimize database access. Server load is too large, an important reason is that the CPU load is too large, reduce the load on the server CPU, can effectively break the bottleneck. Using static pages can minimize the load on the CPU.  Full static at the front desk, of course, the best, can not access the database at all, but for frequently updated sites, static often does not meet certain functions. Caching technology is another solution, that is, the dynamic data stored in the cache file, dynamic Web pages directly call these files, and no longer access to the database, WordPress and Z-blog are heavily used this caching technology.  I have also written a z-blog counter plugin, which is based on this principle. If you do not avoid access to the database, you can try to optimize query SQL for the database. Avoid using statements such as Select *from, and each query returns only the results you need, avoiding a large number of SQL queries over a short period of time.

Third, prohibit the external hotlinking. External Web site picture or file hotlinking often bring a lot of load pressure, so should strictly restrict the external to their own picture or file hotlinking, fortunately, can now simply through refer to control the hotlinking, Apache itself can be configured to prohibit hotlinking, IIS also has some third-party ISAPI that can implement the same functionality. Of course, forged refer can also be implemented by code to achieve hotlinking, but the current deliberate forgery refer hotlinking is not much, you can first not consider, or use non-technical means to solve, such as the image of the watermark added.

Four, control the download of large files. Large file downloads can consume a lot of traffic, and for non-SCSI hard drives, a large number of file downloads can consume CPU, resulting in reduced responsiveness. Therefore, try not to provide more than 2M of large file download, if required to provide, it is recommended to put large files on another server. There are many free Web2.0 websites that offer image sharing and file sharing, so you can upload pictures and files to these sharing sites as much as possible.

Five, use different host to divert the main traffic to put the files on different hosts, provide different images for users to download. For example, if you feel that the RSS files occupy a large amount of traffic, then use services such as FeedBurner or Feedsky to put the RSS output on other hosts, so that others access to the traffic pressure is mostly concentrated on FeedBurner host, RSS does not occupy too much resources.

VI, use traffic analysis statistics software. Install a traffic analysis and statistics software on the website to instantly know which places are consuming a lot of traffic and which pages need to be optimized, so it is necessary to have accurate statistical analysis to solve the traffic problems. I recommend using the Traffic analysis statistics software is googleanalytics (Google Analytics).   I feel that the effect is very good in the process, I will explain in detail some of Googleanalytics's use of common sense and skills. 1. Sub-table 2. Read/write Separation 3. Front-end optimization. Nginx Replacement Apache (front-end load balancer) personally think that the main or the distributed architecture is in place, MySQL and cache optimization is a limited optimization, and distributed architecture to make, PV growth, only need to heap machines can be expanded.

With some optimization experience, first learn to use explain statements to analyze SELECT statements, optimize indexes, table structure, second, reasonable use of memcache and other caches, reduce the load of MySQL, and finally, if possible, Try to use Facebook's hiphop-php to compile PHP and improve program efficiency.

How to resolve web traffic, high concurrency problems

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.