Home >Backend Development >PHP Tutorial >Solving LAN Sharing Software How PHP solves the problem of large traffic and high concurrency of the website

Solving LAN Sharing Software How PHP solves the problem of large traffic and high concurrency of the website

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 08:45:421081browse

First, confirm whether the server hardware is sufficient to support the current traffic.
Ordinary P4 servers can generally support up to 100,000 independent IPs per day. If the number of visits is greater than this,
then you must first configure a higher-performance dedicated server to solve the problem
, otherwise no matter how you optimize it, it will not be completely solved. Performance issues.
Secondly, optimize database access.
It is of course best to achieve complete staticization of the front desk, as there is no need to access the database at all. However, for websites that are frequently updated,
staticization often cannot satisfy certain functions.
Caching technology is another solution, which is to store dynamic data in cache files, and dynamic web pages directly call
these files without having to access the database. Both WordPress and Z-Blog use this caching technology extensively. I
I also wrote a counter plug-in for Z-Blog, which is also based on this principle.
If it is indeed unavoidable to access the database, you can try to optimize the query SQL of the database. Avoid using statements like
Select * from. Each query only returns the results you need, avoiding large
SQL queries in a short period of time.
Third, external hotlinking is prohibited.
Hotlinking of pictures or files from external websites often brings a lot of load pressure, so external hotlinking of your own pictures or files should be strictly restricted. Fortunately, you can control hotlinking simply through refer. Apache has
You can disable hotlinking through configuration. IIS also has some third-party ISAPIs that can achieve the same function.
Of course, fake referrals can also be used to achieve hotlinking through code, but currently there are not many people who deliberately fake referrals to hotlink.
You can ignore it for now, or use non-technical means to solve it, such as adding watermarks to pictures.
Fourth, control the download of large files.
Downloading large files will take up a lot of traffic, and for non-SCSI hard drives, downloading a large number of files will consume
CPU, which will reduce the responsiveness of the website. Therefore, try not to provide downloads of large files exceeding 2M. If necessary, it is recommended to place large files on another server.
Fifth, use different hosts to divert the main traffic
Place files on different hosts and provide different images for users to download. For example, if you feel that RSS files take up a lot of traffic, then use services such as FeedBurner or FeedSky to place the RSS output on other hosts. In this way, most of the traffic pressure of other people's access will be concentrated on FeedBurner's host, and RSS will not occupy too many resources. .
Sixth, use traffic analysis and statistics software.
Install a traffic analysis and statistics software on the website, and you can instantly know which places consume a lot of traffic and which pages
need to be optimized. Therefore, accurate statistical analysis is required to solve the traffic problem. The traffic analysis and statistics software I recommend
is Google Analytics. I feel that its
effect is very good during use. Later I will introduce in detail some common sense and skills of using Google Analytics.
The above introduces how PHP solves the problem of large website traffic and high concurrency in solving LAN shared software, including the content of solving LAN shared software. I hope it will be helpful to friends who are interested in PHP tutorials.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn