How PHP solves the problems of high website traffic and high concurrency

Source: Internet
Author: User
Common P4 servers generally support up to 0.1 million independent IP addresses per day. If the traffic volume is larger than this, you must first configure a dedicated server with higher performance to solve the problem.

Common P4 servers generally support up to 0.1 million independent IP addresses per day. If the traffic volume is larger than this, you must first configure a dedicated server with higher performance to solve the problem.

First, check whether the server hardware is sufficient to support the current traffic.

Common P4 servers generally support up to 0.1 million independent IP addresses per day,
Therefore, you must first configure a dedicated server with higher performance to solve the problem.

Otherwise, it is impossible to completely solve the performance problem.

Second, optimize database access.

The front-end should be completely static. Of course, it is best to do not need to access the database at all. However, for websites with frequent updates,
Static data cannot meet certain functions.

The caching technology is another solution. It stores dynamic data in cache files and directly calls dynamic web pages.
These files, instead of accessing the database, are widely used in WordPress and Z-Blog. Me
I have also written a Z-Blog counter plug-in based on this principle.

If the access to the database cannot be avoided, you can try to optimize the database query SQL.
For a Select * from statement, only the expected results are returned for each query to avoid large values in a short period of time.
SQL query.

Third, prohibit external leeching.

Image or file leeching on external websites often brings a lot of load pressure, so we should strictly limit external
Because of its own image or file leeching, we can use refer to control leeching.
You can disable leeching through configuration. IIS also has some third-party isapis to implement the same function. When
However, spoofing Referer can also implement leeching through code, but currently there are not many attempts to deliberately forge Referer leeching,
You can ignore it or use non-technical means to solve it. For example, you can add a watermark to an image.

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, reducing the website response capability. Therefore, do not provide large file downloads larger than 2 MB if necessary.
Yes. We recommend that you store large files on another server.

Fifth, use different hosts to distribute major traffic

Place files on different hosts and provide different images for users to download. For example
If the traffic is high, use FeedBurner or FeedSky to output RSS to other hosts.
The traffic pressure of others is mostly concentrated on FeedBurner's host, so RSS does not occupy too much resources.

Sixth, use the traffic analysis and statistics software.

Install a traffic analysis and statistics software on the website to instantly know where traffic is consumed and which pages
Therefore, precise statistical analysis is required to solve traffic problems. I recommend
The traffic analysis and statistics software used is Google Analytics ). I feel like it
The results are very good. I will introduce some common sense and skills of Google Analytics in detail later.

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.