Solutions for high traffic websites

Solutions for high traffic websites
First: First, confirm whether the server hardware is sufficient to support the current traffic.
An ordinary P4 server can generally support up to 100,000 independent IPs per day. If the traffic is greater than this, a higher-performance dedicated server must be configured first to solve the problem. Otherwise, no optimization can completely solve the performance problem.
Second: Secondly, optimize access. Database <br />It would be best if the front-end is completely static, without having to access the database at all. However, for frequently updated websites, staticization often cannot meet certain functions.
Caching is another solution, which is to store dynamic data in cache files. Dynamic web pages directly call these files without having to access the database. WordPress and Z-Blog both use this caching technology extensively. I have also written a counter plug-in for Z-Blog, which is also based on the same principle. If you really cannot avoid accessing the database, you can try to optimize the database query SQL. Avoid using statements such as Select * from. Each query only returns the results you need, avoiding a large number of SQL queries in a short period of time.
It is best to perform comparison operations on the same field and minimize function operations on the established index field. If you want to achieve the ultimate, you need to optimize the code;
Third, external hotlinking is prohibited.
Hotlinking to external websites or files often brings a lot of load pressure, so external hotlinking to your own pictures or files should be strictly restricted. Fortunately, hotlinking can be simply controlled through referral, and you can prohibit hotlinking through configuration. IIS also has some third-party ISAPIs that can achieve the same function. Of course, forged referrals can also be used to achieve hotlinking, but at present there are not many people who deliberately forge referrals to achieve hotlinking, so you can ignore it for now, or use non-technical means to solve it, such as adding a watermark to the image.
Fourth, control the downloading 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, reducing the website's responsiveness. Therefore, try not to provide large files larger than 2M for download. If you need to provide them, it is recommended to place the large files on another server.
Fifth, use different hosts to divert main traffic . Place files on different hosts and provide different mirrors for users to download. For example, if you think that RSS files take up a lot of traffic, you can use services such as FeedBurner or FeedSky to put the RSS output on other hosts. In this way, the traffic pressure of others' access will be mostly concentrated on the FeedBurner host, and RSS will not take up too many resources.
Sixth, use traffic analysis and statistical software.
A traffic analysis and statistics software on the website can instantly tell which areas consume a lot of traffic and which pages need to be optimized. Therefore, solving traffic problems requires accurate statistical analysis. The traffic analysis and statistics software I recommend is Analytics (Google Analytics). I feel that its effect is very good during use. Later I will introduce some common sense and skills of using Google Analytics in detail.
Seventh: 4. Transaction processing:
a. Ensure data integrity. For example, if adding and modifying are done at the same time, both will be executed if both are established, and both will fail if one fails.
mysql_query("BEGIN");
mysql_query(“INSERT INTO customerinfo (name) VALUES ('$name1′)”;
mysql_query(“SELECT * FROM `orderinfo` where customerid=”.$id”);
mysql_query("COMMIT");

<<:  A detailed introduction to deploying RabbitMQ environment with docker

>>:  Basic concepts and usage examples of HTML inline elements and block-level elements

Recommend

Learn javascript iterator

Table of contents Introduction What does an itera...

MySQL 5.7 installation and configuration tutorial under CentOS7 64 bit

Installation environment: CentOS7 64-bit MINI ver...

Docker file storage path, get container startup command operation

The container has already been created, how to kn...

Mysql 8.0 installation and password reset issues

Mysql 8.0 installation problems and password rese...

Implementation of MySQL scheduled database backup (full database backup)

Table of contents 1. MySQL data backup 1.1, mysql...

Five ways to achieve automatic page jump in HTML

In the previous article, we introduced three comm...

How to connect to MySQL remotely through Navicat

Using Navicat directly to connect via IP will rep...

Detailed explanation of the difference between JavaScript onclick and click

Table of contents Why is addEventListener needed?...

React+axios implements github search user function (sample code)

load Request Success Request failed Click cmd and...

What are the drawbacks of deploying the database in a Docker container?

Preface Docker has been very popular in the past ...

Understanding Nginx Current Limitation in One Article (Simple Implementation)

Nginx is now one of the most popular load balance...

Vertical and horizontal splitting of MySQL tables

Vertical Split Vertical splitting refers to the s...

Detailed Explanation of JavaScript Framework Design Patterns

Table of contents mvc mvp mvvm The source of Vue ...