Consistent hash and virtual nodes

Source: Internet
Author: User

In the past, when I was doing a project, I simply studied consistent hash. Later, when I looked at the implementation principle of dynamo, I didn't quite understand the virtual nodes in it, and I still didn't find any good materials to explain this problem, yesterday, I happened to see a web crawler in guanggu bookstore and analyzed the problem. Today I found some information on the Internet to deepen my understanding of this issue.

 

Principle of consistent hash: http://blog.csdn.net/sparkliang/archive/2010/02/02/5279393.aspx

Java implementation code of ketama consistent hash algorithm: http://www.javaeye.com/topic/684087

Ketama. Net implementation code: http://www.cnblogs.com/daizhj/archive/2010/08/24/1807324.html

 

After figuring out the problem of virtual nodes, I found that even though the introduction of virtual nodes balances the distribution of keys (when some nodes are launched, keys on the node are evenly distributed to other nodes), and consistent hash is maintained. However, if dynamo maintains multiple replicas for each key, it can directly place the replicas on consecutive nodes. How should we place the replicas after using virtual nodes, several consecutive virtual nodes may correspond to a physical node. You cannot place copies on a physical node. The most intuitive method is round robin, until we find N (number of replicas) virtual nodes corresponding to different physical nodes, Dynamo does this.

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.