How PHP solves the problem of large traffic and high concurrency of the website

Source: Internet
Author: User
Tags dedicated server

 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. 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 a statement like SELECT * from, each time the query returns only the results you want, 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. 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. The Traffic Analysis Statistics software I recommend is Google Analytics. 

How PHP solves the problem of large traffic and high concurrency on the site

Related Article

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: 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.