Introduction. Distributed data processing and storage systems require efficient methods to distribute keys across buckets. While simple and fast, the traditional modulo-based mapping is unstable when the number of buckets changes, leading to spikes in system resource utilization, such as network or database requests. Consistent hash algorithms minimize remappings but are either significantly slower, require floating-point arithmetic, or are based on a family of hash functions rarely available in standard libraries. This work introduces JumpBackHash, a consistent hash algorithm that overcomes those shortcomings. Methodology. JumpBackHash applies the concept of active indices borrowed from consistent weighted sampling, which inherently leads to consistency. It generates the active indices in reverse order, which avoids floating-point operations, enables the minimization of consumed random values and the use of a standard pseudorandom generator, and finally leads to a very efficient algorithm. Results. Theoretical analysis shows that JumpBackHash has an expected constant runtime. The expected value and the variance of the number of consumed random values perfectly agree with the experiments. Empirical tests also confirm the consistency. Conclusion. JumpBackHash offers a fast and efficient solution for uniformly distributing keys across buckets in distributed systems. Its simplicity, performance, and the availability of a production-ready Java implementation as part of the Hash4j open source library make it a viable replacement for the modulo-based approach for improving assignment and system stability.


翻译:引言。分布式数据处理与存储系统需要高效的方法将键分配到各个桶中。传统的基于取模的映射方法虽然简单快速,但在桶数量发生变化时不稳定,会导致系统资源利用率(如网络或数据库请求)出现峰值。一致性哈希算法能最小化重映射,但其要么显著更慢、需要浮点运算,要么基于标准库中很少提供的哈希函数族。本文介绍了JumpBackHash,一种克服这些缺点的一致性哈希算法。方法学。JumpBackHash借鉴了一致性加权采样中的活跃索引概念,该概念天然具备一致性。算法以逆序生成活跃索引,从而避免了浮点运算,实现了随机值消耗的最小化,并能使用标准伪随机数生成器,最终形成一个非常高效的算法。结果。理论分析表明JumpBackHash具有期望常数时间复杂度。随机值消耗数量的期望值与方差与实验结果完全吻合。实证测试也证实了算法的一致性。结论。JumpBackHash为分布式系统中键在桶间的均匀分布提供了一种快速高效的解决方案。其简洁性、高性能以及作为Hash4j开源库一部分的生产就绪Java实现,使其成为改进分配与系统稳定性的、替代基于取模方法的可行选择。

0
下载
关闭预览

相关内容

【NeurIPS2019】图变换网络:Graph Transformer Network
NAACL 2019 | 一种考虑缓和KL消失的简单VAE训练方法
PaperWeekly
20+阅读 · 2019年4月24日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
10+阅读 · 2014年12月31日
VIP会员
相关基金
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
10+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员