关于一致性哈希算法的介绍,网上挺多的,图文并茂,易懂详细,例如:一致性哈希算法与Java实现
- key的哈希及服务集群节点的哈希应该用同一个哈希函数。尽管理论上可以用不同函数,只需要保证这两个hash函数的哈希值范围及均匀性相近就行,但实际中完全没理由这么做,除非想没事找事,脱裤子放屁..
- 每个节点的可虚拟节点数,及总的虚拟节点数,应该有已被实践过的参考范围,而不应该是越多越好。同时,随着实际节点数的变化,对应的总的虚拟节点数也应该是动态的。而不是线性的。
- 实际开发中难点还有一处,就是如何有效的发现集群中节点的变化,也就是动态的删除,增加节点。