# demo-hash **Repository Path**: javanasoda/demo-hash ## Basic Information - **Project Name**: demo-hash - **Description**: 一致性哈希算法实践 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-05-19 - **Last Updated**: 2021-12-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 一致性哈希 没有虚拟节点的一致性哈希测试类 - com.example.demohash.NoVirtualNodeConsistentHashTest 有虚拟节点的一致性哈希测试类 - com.example.demohash.VirtualNodeConsistentHashTest 测试结果对比: 1. NoVirtualNodeConsistentHashTest ```java node[192.168.1.52] save key count is 138527(13.85%) node[192.168.1.32] save key count is 226025(22.6%) node[192.168.1.42] save key count is 19385(1.94%) node[192.168.1.2] save key count is 11180(1.12%) node[192.168.1.12] save key count is 543956(54.4%) node[192.168.1.22] save key count is 60927(6.09%) ``` > 结果非常不平均 2. VirtualNodeConsistentHashTest ```java node[192.168.1.52] save key count is 178859(17.89%) node[192.168.1.32] save key count is 136105(13.61%) node[192.168.1.2] save key count is 145009(14.5%) node[192.168.1.42] save key count is 166856(16.69%) node[192.168.1.12] save key count is 159425(15.94%) node[192.168.1.22] save key count is 213746(21.37%) ``` > 结果分散相对平均 # 动态更新(周四再想想补上)