About the granularity of Vertical Sharding

The granularity of vertical segmentation refers to how many levels of association tables are allowed to be placed in a shard when vertical segmentation is performed. This problem has a great impact on applications and sharding implementations.

 

The more the association is interrupted, the more join operations are affected, and the greater the compromise the application makes for this, but the routing of a single table will be simpler, the less related to the business will be, and the easier it will be to use Unified mechanism for processing. An extreme solution in this direction is: break all connections, each table is equipped with routing rules, which can be handled automatically using a unified mechanism or framework. For example, in frameworks like amoeba, its routing can and only be routed through SQL features (such as the id of a table).

 

Conversely, if there are fewer interruptions in the association, the join operation will be less restricted, and the application needs to make less compromises, but the routing of the table will become more complicated, and the correlation with the business will be greater. The more difficult it is to use the unified mechanism to process, the routing needs to be implemented separately for each data request. An extreme solution in this direction is: all tables are in one shard, that is, there is no vertical split, so that no associations are broken. Of course this is very extreme, unless the entire database is simple and the number of tables is small.

 

The actual granularity control needs to be considered in combination with the two factors of "business closeness" and "table data volume". Generally speaking:

  • If the tables that are grouped together are closely related, the data volume is not large, and the growth rate is very slow, it is suitable to be placed in a shard, and no further horizontal segmentation is required;
  • If the amount of data in the tables grouped together is huge and the growth rate is rapid, it is necessary to perform horizontal segmentation on the basis of vertical segmentation. Horizontal segmentation means that the original single shard will be subdivided into multiple smaller ones. shard, each shard has a main table (that is, the table that will be hashed with the table ID) and multiple related association tables.

In a word, the granularity of vertical segmentation presents a situation in which advantages and disadvantages coexist and compete with each other in two opposite directions. What the architect

 

Reprinted: http://blog.csdn.net/bluishglc/article/details/6274841

Guess you like

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