diff --git a/ch6-cloud/ch6-07-dist-id.md b/ch6-cloud/ch6-07-dist-id.md index e69de29..ae704c8 100644 --- a/ch6-cloud/ch6-07-dist-id.md +++ b/ch6-cloud/ch6-07-dist-id.md @@ -0,0 +1,26 @@ +# 6.7. 分布式 id 生成器 + +``` + + datacenter_id sequence_id + unused + │ │ + │ │ │ + │ │ │ + │ │ │ │ │ + │ │ │ │ │ + ▼ │◀────────────────── 41 bits ────────────────────▶│ ▼ ▼ + ┌─────┼──────────────────────────────────────────────────────┼────────┬────────┬────────────────┐ + │ 0 │ 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0 │ 00000 │ 00000 │ 0000 0000 0000 │ + └─────┴──────────────────────────────────────────────────────┴────────┴────────┴────────────────┘ + ▲ ▲ + │ │ + │ │ + │ │ + │ │ + │ │ + │ │ + + time in milliseconds worker_id + +```