知识卡片

问题卡 · 4443

ID位数分配约束容量

理解等级:中级

41 位毫秒时间戳可覆盖约 69 年,12 位序列在同一毫秒内提供 4096 个取值。调整字段长度是在寿命、部署规模与单机并发间分配空间;纪元和机器身份改变必须考虑旧 ID 兼容与冲突。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 唯一ID · 查看原书依据

      Timestamp The most important 41 bits make up the timestamp section. As timestamps grow with time, IDs are sortable by time. Figure 7-7 shows an example of how binary representation is converted to UTC. You can also convert UTC back to binary representation using a similar method. The maximum timestamp that can be represented in 41 bits is 2 ^ 41 - 1 = 2199023255551

    参考来源

    - 位置:《System Design Interview – An insiders guide, Second Edition》第07章《唯一ID》(来源项目 book-sources;源文件:extracted/System Design Interview – An insiders guide, Second Edition/_epub-src/text/part0019_split_003.html) - 结论依据:原文在该位置给出所述对象、机制或比较,支持本卡的解释;原书未展开的实现不作为已证明结论,算式与一致性边界在正文明确限定。 - 原始内容:Timestamp The most important 41 bits make up the timestamp section. As timestamps grow with time, IDs are sortable by time. Figure 7-7 shows an example of how binary representation is converted to UTC. You can also convert UTC back to binary representation using a similar method. The maximum timestamp that can be represented in 41 bits is 2 ^ 41 - 1 = 2199023255551