ID Generator Cheat Sheet
Key concepts, trade-offs, and quick-reference notes for your interview prep.
Snowflake Layout: 1 + 41 + 10 + 12
#1💡 Say what each field BUYS, not just the widths. The layout is the design.
UUID vs Snowflake: The Locality Tax
#2💡 Rightmost-page appends vs random-page inserts is the whole B-tree story. Know UUIDv7 exists.
Clock-Backward Policy Ladder
#3💡 Availability vs safety: always choose safety. A paused generator fails loudly; a duplicating one corrupts quietly.
Worker IDs: Leases with Fencing
#4💡 The fencing deadline is the answer to "what if the ZooKeeper session expires during a GC pause?"
What K-Sortability Buys
#5💡 Enumerate the five buys. "Sortable" as a checkbox wastes the topic's best material.
Real Ceiling: RPC, Not Bits
#6💡 Candidates quote the bit ceiling; the network is the real one. Batching is the standard answer.
Sequence Overflow: Spin to Next Millisecond
#7💡 Saturation ratio is the leading indicator; p99 latency is the lagging one.
Ticket Servers and Range Allocation
#8💡 One pattern, three topics: URL-shortener counters, ticket servers, worker-ID leases. Amortize coordination with ranges.
Custom Epoch: The Irreversible Parameter
#9💡 Bit budgets flex, worker schemes migrate: the epoch is forever. Derive 69.7 years on the whiteboard.
Monitoring an ID Generator
#10💡 The duplicate canary converts "cannot happen" into "we would know in seconds if it did."