Discussion on database cluster (i.)

Source: Internet
Author: User

Now, with the proliferation of Internet users, some large sites are starting to use database clusters to improve database reliability and database performance. So before you introduce a database cluster, you need to figure out a few questions first.

1. Why use a DB cluster

(1) Through the use of database cluster can make the read and write separation, improve the database system performance.

As we all know, MySQL is supported by distributed. One of the most powerful features of MySQL Proxy is the realization of "read and write separation (Read/write splitting)". The basic principle is to have the primary database handle transactional queries, and from the database

Select query. Database replication is used to synchronize changes caused by transactional queries to the slave database in the cluster, thus keeping the data from the database and the primary database consistent. Of course, the primary server can also provide query services.

The most important effect of using read-write separation is environment server pressure. You can look at this picture:

——————————————————————————————————————————————————————————

Why can read and write separations improve database performance? (Excerpt from the network)

1. Increased physical servers, increased load
2. Master and slave only responsible for the respective write and read, the maximum degree of relief x lock and S lock contention
3. Configure the MyISAM engine from the library to improve query performance and save system overhead
4. From the library to synchronize the main library's data and the main library direct write or a different, binlog from the main library to recover data, but the most important difference is that the main library to send Binlog from the library is asynchronous, the recovery of data from the library is also asynchronous
5. Read and write separation application and read much more than writing scenarios, if there is only one server, when select many, update and delete will be in these select Access data congestion, waiting for select end, concurrency performance is not high. For applications with similar write and read ratios, you should deploy a dual-master replication

6. You can start from the library by adding some parameters to improve the performance of their reads, such as--skip-innodb 、--skip-bdb 、--low-priority-updates and--delay-key-write=all. Of course, these settings also need to be based on specific business needs, not necessarily be able to use

7. Distribute the read. If we have 1 Master 3 from, not considering the one-sided setting mentioned in the above 1 from the library, assume that there are 10 writes and 150 reads in 1 minutes now. So, the 1 Master 3 writes from the equivalent of a total of 40, while the total number of reads does not change, so on average each server assumes 10 writes and 50 reads (the main library does not assume the read operation). Therefore, although the write is not changed, the read is greatly distributed, which improves the system performance. In addition, when the read is allocated, the performance of the write is increased indirectly. As a result, the overall performance is improved, the white is to take the machine and bandwidth for performance. MySQL official documentation has the relevant Calculus formula: Official document See 6.9FAQ "when and how far MySQL replication can improve system performance"

8.MySQL replication Another big function is to increase redundancy, improve availability, when one database server down can be adjusted from the libraries authoring to the fastest speed recovery service, so can not see the performance, that is, 1 Master 1 is also possible.

——————————————————————————————————————————————————————————

2. What is the difference between a DB cluster and a distributed database?

Bottom line: Distributed is the parallel work, the cluster is working in tandem.

1: Distributed refers to the distribution of different businesses in different places. Clustering, however, refers to centralizing several servers together to achieve the same business. Each node in the distribution can be a cluster. The cluster is not necessarily a sub-

Cloth-type.

For example: Sina, for example, more people visit, he can do a cluster, the front of a response server, the next few servers to complete the same business, if there is business access, the response server to see which server

The load is not very heavy, it will be given which one to complete. and distributed, from the narrow meaning of understanding, but also similar to the cluster, but its organization is relatively loose, unlike clustering, there is an organizational, a server collapsed, the other servers can be top up.

distributed to each node, the completion of a different business, a node collapsed, which business is inaccessible.

2: To put it simply, distributed is to improve efficiency by shortening the execution time of a single task, while clustering increases efficiency by increasing the number of tasks executed per unit of time.

For example, if a task consists of 10 subtasks, and each subtask takes 1 hours to execute separately, it takes 10 hours to perform the task on a single server.

The distributed scheme provides 10 servers, each server is responsible for only one sub-task, regardless of the dependencies between subtasks, it takes one hours to complete this task. (A typical representation of this mode of work is

Map/reduce distributed computing model for Hadoop)

The use of cluster scheme, also provides 10 servers, each server can handle this task independently. Assuming 10 tasks arrive at the same time, 10 servers will work at the same time, and after 1 hours, 10 tasks are completed simultaneously, so that

The whole body, or 1 hours to complete a task!

See:

Reprinted from: Http://blog.csdn.net/zhangzijiejiayou

Discussion on database cluster (i.)

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.