知识卡片
分片函数要求稳定
路由函数把请求键映射到目标片,确定性让同一键稳定找到同一数据,近似均匀分布降低键数量偏斜。hash(key)%N是简单实现,但哈希取值到有限N的分布不必严格相等,语言默认哈希也可能跨进程变化;实际键访问频率和处理成本仍可能形成热点。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Chapter 7. Sharded Services · 查看原书依据
The hash function has two important characteristics for our sharding: Determinism The output should always be the same for a unique input. Uniformity The distribution of outputs across the output space should be equal. For our sharded service, determinism and uniformity are the most important characteristics.
参考来源
- 位置:《Designing Distributed Systems, 2nd Edition》第07章《Chapter 7. Sharded Services》(来源项目 book-sources;源文件:extracted/Designing Distributed Systems, 2nd Edition/_epub-src/OEBPS/ch07.html)
- 结论依据:原文说明determinism与uniformity及取模映射,保留作用并限制均匀保证。
- 原始内容:The hash function has two important characteristics for our sharding: Determinism The output should always be the same for a unique input. Uniformity The distribution of outputs across the output space should be equal. For our sharded service, determinism and uniformity are the most important characteristics.