Multi-room distribution strategy in distributed cache

Source: Internet
Author: User

In the current Internet architecture, the cache has become an indispensable part, can be no cache, many things do not turn, the current use of more open source, such as memcached, but also the company's own research and development of caching systems, such as Taobao has been open source Tair, When the number of cached servers increased or the need for more than one room disaster, the data in the case of multiple computer room How to allocate, has become a problem, this article on the issue of discussion.

For distributed caching, composed of a cluster machine, these machines have a characteristic, is memory is very good, no way, do caching is to put in memory, but also have the hardware of the memory server to buffer, the memory file dump to the hard disk, for machine power outages and so on. Although by a cluster (that is, many machines), but for the application system, they are a machine, a cache-providing machine.

Application system in the request cache, it may only need to simply cache the machine list, and then send a request, buffer machine automatic hash and other operations, these are transparent to the application system.

What are the current distribution strategies? Simply enumerate a few, some are met in the work, some are their own yy, but also basic reliable.

machines distributed in a single room, single data

The advantages of seemingly only convenient management, the physical machine in a computer room, if the application machine in multiple machines, it is possible to have a cross room call. If there is a problem with the machine room, the room itself is not able to tolerate disaster.

machine Distribution of a number of computer rooms, a data, for the external, is a cluster

This distribution, the machine may be equal to the distribution in multiple room, storage of a piece of data, although the physical deployment is separate, but logically, the outside is that he is a cluster, if the application system is also distributed in a number of computer rooms, there will be a cross room call the situation, the expansion of the computer room what problem. The call network latency in different computer rooms will be relatively large. But the general room between the call is very fast. This deployment is ideal for caching class data and is less sensitive to cross room calls. In this case, if a computer room down machine, that the machine corresponding data will be lost, but the problem is not very small, because it is cached data, can continue from the persistence of the system inside to load in. Since it is a single piece of data, there is no question of consistency.

machine distributed in a number of computer rooms, a data room, for the external, each room is equivalent to a separate cluster

The biggest advantage of this distribution is that the application server and the caching machine if in the same room, the network delay will be very small, the engine room call strategy can be configured, such as the application server in the room can only call the computer room cache machine. But because the data of each room is independent, that is, independent cluster, the data consistency exists problem, if the application system updates the data, it is necessary to update each cluster synchronously, this time, the independent cluster data consistent how to guarantee it. The current known solution is to add a separate cluster (called a-server) to do this, and the updated request is sent here, which is responsible for synchronizing data to each data cluster to ensure consistency.

two computer room, mutual main preparation, two data, classic main standby mode

Main Standby mode is that we often see, under normal circumstances, the main cluster to provide services, the main cluster to engage in an asynchronous thread to synchronize data to the standby cluster, when the main cluster is hung out, the application system automatically switch request road standby cluster. This is a guarantee of data consistency, and many DB are currently using this. The most common is the MySQL master-slaver mode, if the ratio of read and write request is very big things, such as a large read request, you can increase the number of slaver to block some read requests. In this mode, the data security is relatively high.

machine distributed in a number of computer rooms, a number of data, for the external, the overall is a cluster

A cluster of data, but a number of clusters on multiple data, the overall external is a cluster, rather than a separate cluster, so that the advantage is that the application server to choose the local computer room priority strategy to do things.

Of course, in the actual processing, there may be some, how to choose it. According to the business scene to choose, these days or scenes for the king of the era Ah, can not be mechanically.

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.