作业 - 第 5 周
1-实现哈希一致性算法
哈希一致性算法是常用的负载均衡算法,本实现模拟一个负载均衡器,对集群中的服务器节点进行管理和数据写入写出。
负载均衡器实现负载均衡服务器接口

哈希一致性算法实现负责接口,负责服务器节点的增加,删除,数据操作时服务器节点的分配

具体实现见 https://github.com/arcyao/Architecture/tree/main/HashConsistencyAlgorithm
2-哈希一致性算法测试
模拟10台服务器的集群,进行100万进行写入,调整每个服务器对应的虚拟节点,利用标准平方差,对算法进行测试,测试结果如下:

从结果看负载均衡的标准平方差越来越小,但写入的总耗时有增加。由于数据的写入是顺序的写入,不清楚在并发情况的写入性能是否有明显的差别。
具体测试实现见 https://github.com/arcyao/Architecture/tree/main/HashConsistencyAlgorithm
评论 (2 条评论)