I. Overview
In a distributed environment, developers often encounter a number of distributed storage scenarios, such as database sub-Library sub-table (such as the user ID tail number 1 into the database 1,id tail number to 2 into the database 2), and such as the acquisition of distributed cache data (such as the distribution of cached data based on IP address storage). In this case, how to quickly put the data into the specified location, and how fast access is the most basic requirements, for this implementation, there are the following two common ways:
1, Configuration Center Pull: In this case, the data is routed through this central node pull-up configuration, in the following way:
The advantages and disadvantages of this model are obvious, the advantage is easy to maintain, the back of the elastic expansion will only need to operate the configuration center data, can do the dynamic completion of the expansion of the DB and other problems. The disadvantage is that in the case of configuration center in the event of a problem, the consequences are catastrophic, easy to have a single point of failure, and when the subsequent data volume is particularly large, the configuration center may itself become the bottleneck of the system.
2, for the need to operate data, through a certain rule to generate a key, and then according to the key to perform a certain rule operation, directly get to the specific data operation address. Some of the algorithms described in this article are implemented in this way.
Consistency hash Algorithm application scenario, elaboration and implementation (JAVA)