DD
Unique ID Generator · Deep Dives
Deep Dives
Nine deep dives — single-server counter, multi-server problem, UUID, ticket server, pre-generated key pool, Snowflake, algorithm comparison, clock skew, and fault isolation.
Single Server Counter
The simplest approach — auto-increment on a single DB. Works until it doesn't.
Auto-IncrementSingle DB
Open →
Multi-Server Problem
Why a single counter breaks at scale and what the distributed ID problem actually is.
DistributedUniquenessCoordination
Open →
UUID
128-bit random IDs — no coordination needed, but no ordering either.
UUID128-bitNo Ordering
Open →
Ticket Server
Centralised counter server — ordered IDs, but a single point of failure.
Ticket ServerCentral CounterSPOF
Open →
Pre-Generated Key Pool
Pre-generate IDs in bulk and hand them out — trades coordination for latency.
Key PoolPre-GenerationBulk Allocation
Open →
Snowflake
Twitter's 64-bit ID — timestamp + datacenter + worker + sequence. Sorted, distributed, fast.
Snowflake64-bitTimestampSortable
Open →
Comparison
All five approaches side-by-side — uniqueness, ordering, coordination, scalability, and tradeoffs.
TradeoffsComparison
Open →
Clock Skew
Why wall-clock timestamps break distributed ordering and how NTP drift causes duplicate IDs.
Clock SkewNTPMonotonic Clock
Open →
Fault Isolation
Worker node failure, clock going backward, and sequence exhaustion — each isolated and handled.
Node FailureClock BackwardSequence Exhaustion
Open →