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

Detailed installation process of nodejs management tool nvm

nvm nvm is responsible for managing multiple vers...

Talk about the understanding of CSS attribute margin

1.What is margin? Margin is used to control the sp...

Introduction to fourteen cases of SQL database

Data Sheet /* Navicat SQLite Data Transfer Source...

Vue implements a scroll bar style

At first, I wanted to modify the browser scroll b...

Tutorial on installing lamp-php7.0 in Centos7.4 environment

This article describes how to install lamp-php7.0...

Use and understanding of MySQL triggers

Table of contents 1. What is a trigger? 2. Create...

Solution for Nginx installation without generating sbin directory

Error description: 1. After installing Nginx (1.1...

Sample code for implementing form validation with pure CSS

In our daily business, form validation is a very ...

Diving into JS inheritance

Table of contents Preface Prepare Summarize n way...

Detailed explanation of the EXPLAIN command and its usage in MySQL

1. Scenario description: My colleague taught me h...

CSS realizes div completely centered without setting height

Require The div under the body is vertically cent...

HTML special character conversion table

character Decimal Character Number Entity Name --...

How to use lazy loading in react to reduce the first screen loading time

Table of contents use Install How to use it in ro...