Design a Distributed ID Generator
MediumSystem design · Distributed Systems · Microsoft
Design a service that produces unique 64-bit IDs for many distributed services across regions. IDs should be roughly time-ordered so database indexes stay compact, with no central bottleneck on the hot path. Target 1M IDs/s across up to 1,024 generator nodes. Cover the bit layout, node-ID assignment, clock handling, and when a simpler alternative is the better answer.
Requirements
- No single global counter or database on the ID generation path
- Uniqueness is strict; ordering is only approximately by time across nodes
- Explain clock-skew and clock-rollback handling and restarts
- Safe operation across machines, regions and autoscaling