Website Problems
A few days ago, some users reported that "the website is slow" and "the website cannot be opened "... It is indeed much slower than usual.
Website overview and pressure
First, let's briefly introduce the website reflected by the user so that you can have a general understanding of the website and database pressure.
The website is a classified information network, and the pressure naturally falls on information processing. For information processing, there are two main pressures on databases:
1. the info table is read on the homepage;
2. the info table is read on the Information List page;
According to statistics, at this time, the info table contains more than 3.6 million data records. Each user must access the home page or detail list page of the website from more than 3.6 million pieces of data
Find the desired data. This causes many problems such as "Slow Website.
From this perspective, as far as the current website architecture is concerned, more than 3.6 million pieces of data have become the maximum pressure that the system can withstand.
Solutions to such problems
We should have some knowledge about how to deal with such problems, such as optimizing the website architecture, using caches, and using distributed architectures. Considering that these are not the focus of this article
I am not very familiar with this, so I will not describe it.
Solution
Using the "Table sharding" method, the so-called "Table sharding" method is to extract the backbone of the latest tens of thousands or hundreds of thousands of data entries in the info table and put it in another new information table newinfo,
Try to follow the principle "the fewer fields stored in the newinfo table, the better, and minimize table connections, while ensuring that users can see the complete information. . Such a website
The data displayed on the home page and Information List page can be read from newinfo. It is faster to retrieve tens of thousands of pieces of data and obtain millions of pieces of data. You may have
Are other data in info missing? Don't worry. After reading this, you may understand that this is not necessary.
Of course, this will also cause a little trouble for Information Modification (because data consistency needs to be maintained ). However, by comparison, you will find that the benefits outweigh the disadvantages.
Summary
When the information volume of a classified information network is large, a large amount of information is generated every day. If you want to display millions or even tens of millions of data from the database.
Which of the following users will finish reading the video. In addition, users need timely information.
If you have used "Ganji" or "58 City", you will find that most of their information sources are the same day.