Jump to a problem, path or page
Jump to a problem, path or page
01 · Frame the problem
Design a service issuing sortable 64-bit IDs across several workers. Network partitions and worker restarts must not silently reuse identities. State exactly what chronological ordering can and cannot mean.
Uniqueness depends on worker ownership and restart/clock behavior as much as the bit layout. Establish the issuance envelope before choosing timestamp, worker and sequence field sizes.
02 · Find the design pressure
Begin with one serialized generator and a specified encoding. Adding workers without exclusive identities permits collisions; wrapping a sequence or rolling time backward reuses tuples. Define conservative stop/wait behavior instead of sacrificing uniqueness for availability.
03 · Define success
Workload: 1,000 reads/s, 50,000 writes/s, 100 B records, 100 ms read p99 target. These are exercise assumptions; the Solution includes capacity formulas.
04 · Identify the correctness boundary
Specify bit widths and overflow behavior before implementing shifts. A worker identity must remain exclusive across partitions and restarts; a lease name alone is insufficient if an old process can keep issuing IDs. Persist conservative issuance bounds and stop when clock or ownership assumptions cannot be established.
05 · Make it concrete
A worker exhausts its per-millisecond sequence while the clock has not advanced. It waits or returns bounded backpressure instead of wrapping. After a restart, it respects its persisted issuance boundary. A clock rollback cannot cause reuse of the same timestamp, worker and sequence tuple.