← 返回刚才阅读的位置

知识卡片

问题卡 · 4421

取模扩容导致大量迁移

理解等级:高级

用 hash(key) 对服务器数取模时,服务器数变化会改变许多键的归属,连原本不在故障节点上的键也可能迁移。在缓存场景中这会集中触发未命中,扩容成本不能只按新增节点的数据量估计。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 一致性哈希 · 查看原书依据

      The rehashing problem If you have n cache servers, a common way to balance the load is to use the following hash method: serverIndex = hash(key) % N, where N is the size of the server pool. Let us use an example to illustrate how it works. As shown in Table 5-1, we have 4 servers and 8 string keys with their hashes. To fetch

    参考来源

    - 位置:《System Design Interview – An insiders guide, Second Edition》第05章《一致性哈希》(来源项目 book-sources;源文件:extracted/System Design Interview – An insiders guide, Second Edition/_epub-src/text/part0012_split_001.html) - 结论依据:原文在该位置给出所述对象、机制或比较,支持本卡的解释;原书未展开的实现不作为已证明结论,算式与一致性边界在正文明确限定。 - 原始内容:The rehashing problem If you have n cache servers, a common way to balance the load is to use the following hash method: serverIndex = hash(key) % N, where N is the size of the server pool. Let us use an example to illustrate how it works. As shown in Table 5-1, we have 4 servers and 8 string keys with their hashes. To fetch