Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geecache day4 一致性哈希疑问 #63

Open
WilliamDreamWord opened this issue Nov 5, 2022 · 2 comments
Open

geecache day4 一致性哈希疑问 #63

WilliamDreamWord opened this issue Nov 5, 2022 · 2 comments

Comments

@WilliamDreamWord
Copy link

尊敬的作者,您好:
在学习您的geecache day4 一致性哈希章节中针对该算法有个疑问,“环上有 peer2,peer4,peer6 三个节点,key11,key2,key27 均映射到 peer2,key23 映射到 peer4。” 这个部分不太理解,当前环上有三个节点的话,key11映射的节点为 11%3=2顺时针映射peer2,key2映射的节点应该 2%3=2顺时针映射peer2,key27映射的节点为27%3=0顺时针映射peer2,key23映射的节点不也应该为23%3=2 peer2 吗?
这个地方一直没搞明白,望您有空点拨下。万分感谢。

@WilliamDreamWord
Copy link
Author

是因为定义的哈希函数为 n%10吗?

@Creat-qc
Copy link

peer后面跟的字母没有意义,我理解真正起到节点排序作用的是节点名称hash后的值,这里作者可能只是随便写了几个数字,(不然key2两边为什么会有key11和key23),理解作者的意思就好,我和你对一致性hash的理解是一致的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants