MySQL and distributed

Source: Internet
Author: User

Distributed MySQL Databases use a single master with multiple slave architectures. Through the replication of master and slave, the application server can query slave through the Load balancer. In this way, the query can be distributed across multiple servers.

In this case, the application should send only the query of read classes such as select to the Server Load balancer, and the update query should be sent directly to the master. If an update query is executed on the slave, the content of the slave and Master cannot be synchronized. MySQL detects the content difference between the master and slave and stops replication. This will cause system faults. Therefore, the update must be sent to the master.

In addition, there is still a way to use a Load balancer (such as LVS) before slave. For example, you can control query allocation in an application or use a MySQL proxy class.

Therefore, the distributed architecture of MySQL has only one master, which is not suitable for updating too many queries. Generally, web applications read queries much more than update queries, so the query conditions can be met. However, there are also many update queries, such as the function of recording the number of video playback times, which must be updated every time a video is played. In this case, we still need to split the table to reduce the table size. Split to distribute write operations. If table files can be split, they can be distributed to multiple hard disks on the same machine, or to multiple servers. Then, we can consider not applying RDBMS, instead using key-value for storage.

In addition, database segmentation also has its own advantages and disadvantages:

  • Advantages

    • Load Reduction

    • Increase locality and improve cache Performance

  • Disadvantages

    • O & M becomes complex and failure rate increases

    • After O & M becomes complex, the economic cost will also rise.

    • The current Memory price is also low

Related Article

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.