MySQL extension

Please indicate the source of the original reprint: http://agilestyle.iteye.com/blog/2390898

 

business split

It turned out that a database needs to be split into several libraries, and each business uses a separate database for storage, which improves throughput and development and testing efficiency, and also improves system stability.


 

replication strategy

After the database is dismantled, the business continues to expand, the pressure on a certain database is increasing, and the performance bottleneck is reached again. At this time, the MySQL replication strategy can be used to expand the system. To achieve database replication, it is necessary to open the Binary log on the Master server.

 

Sub-table and sub-library

For Internet companies, most of the data is associated with users, so user id is the most commonly used table field.

The sub-library can also route data access by taking the modulo of a keyword


Sometimes the database may face the pressure of this high concurrent access, and it needs to face the storage problem of massive data. At this time, it is necessary to adopt the sub-database sub-table strategy for the database, for example:

Intermediate variable = user_id % (number of libraries x number of tables per library)

library = rounded (intermediate variable / number of tables per library)

tables = intermediate variable % number of tables per library


After the database undergoes business splitting and sub-database and sub-table, although the query performance and concurrent processing capability are improved, it also brings a series of problems. For example, the original cross-table transaction has been upgraded to a distributed transaction; since records are divided into different databases and different tables, it is difficult to perform multi-table association queries, and it is not possible to specify routing fields to query data. After sub-database and sub-table, if the system needs to be further expanded (routing policy change), it will become very inconvenient, and data migration needs to be performed again.
 

Reference

Architecture Design and Practice of Large Distributed Website by Chen Kangxian


 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326117006&siteId=291194637