Amoeba for MySQL

Source: Internet
Author: User

Amoeba is a middle layer developed by one of Alibaba's colleagues Based on the mysql client and server. It has some common features such as read/write splitting, data splitting, and filtering in distributed databases.

Functions of amoeba

A product similar to Amoeba is mysql-proxy provided by MySQL, but this product is not only immature but also has many problems, the MySQL-proxy on and off the MySQL official website basically has no function, and we need to write the Lua script to complete these things by ourselves, for those who just want to use these functions, the learning cost is also a little high, so with the amoeba open-source project, he can automatically complete all the functions, all we need to do is change the configuration.

Functional modules of amoeba:

The conf directory is the configuration file of amoeba, which is important to some amoeba. XML and dbserver. XML, rule. if you only want to implement some read/write splitting functions, you only need to configure

Amoeba. XML and dbserver. XML. If you want to use the horizontal data splitting function, configure rule. for XML and Amoeba data sharding rules, you need to fill in the Data sharding rules by yourself. It is more common to perform modulo based on the primary key. For example, two MySQL Databases can perform modulo operations on two databases, for future extensions, we can perform modulo 4 and 8, and configure rule. when using XML, you need to fill in a balanced field. The modulo is based on this field. Generally, the int type can be removed, and the string type can be used to calculate the hashcode.

 

Amoeba Performance

Amoeba's performance is quite good. According to my tests, when an intermediate layer is added, MySQL QPS drops within 10% (non-full memory, select, and update tests)

 

Amoeba Defects

In amoeba, all functions need to be configured. If you need to add a new configuration or add a new splitting rule, restart the system. If you need to split a large number of tables, the configuration file is very long.

Amoeba does not support distributed transactions. This is a tough headache for amoeba.

If amoeba is used for read/write splitting, it also separates the read and write operations in a transaction. This is a big problem.

Amoeba is very careful about the writing of SQL statements. For example, if Table A is separated by ID, the ID must be entered in the insert statement. Otherwise, no cutting is required. What does it mean:

Insert into a (ID) values (1) Cut

Insert into a values (1) without cutting.

The matching is performed based on SQL statements. This is not good, and the balanced fields are better stored.

 

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.