Horizontal expansion and vertical expansion of the database

Source: Internet
Author: User
Tags database sharding

Database horizontal scaling and vertical scaling

in Internet applications, databases are often the common medium in which we store and access data. With the increase of load, the requirement of database read and write performance is often a big challenge. In this case, we can consider the database-related replication mechanism to improve the performance of read and write. Due to the general use of a write-and-read replication mechanism (write master synchronization to multiple slaves), this mechanism is often flawed. First of all, it relies on the ratio of read and write, if there are too many operations, the master often becomes the bottleneck of performance, which makes the data synchronization delay of the slaves become larger, thus greatly consumes the CPU resources, and causes inconsistent data to affect the user's experience.

This time we should consider the use of the Database sharding (shard) mechanism, which we say that the sharding mechanism is not a database software ancillary functions, but a relatively simple software concept. In general, we divide the sharding mechanism into horizontal expansion (scale-out, or scale-out) and vertical expansion in two ways. Specifically what is the horizontal and vertical expansion of a database? Let's take the following example to illustrate this.

For example, we now have two tables: User Information table product order Form

The horizontal split scheme, that is, does not modify the database table structure, by splitting the data in the table to achieve the purpose of sharding:

1) Use User ID to do hash, decompose database, use User ID in accessing database to do route.

2) The Product order form is divided into two tables according to the placed and not placed orders.

General Horizontal split the union operation may be used when querying the database.

Vertical split Scenario: detach the table and table, or modify the table structure to split some columns according to the difference in Access.

1) Place the user Information table in a database server and place the product order table in a database server.

2) The main code in the User Information table (usually the user ID) and some common information into a table, the main code and the less commonly used information to the other table, which leads to the general query data may be used when the join operation.

In the design of the database, we focus more on the ability of the database to scale horizontally.

Horizontal and vertical scaling of databases

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.