Design Problems/Unique ID Generator

Unique ID Generator

Medium
Distributed SystemsScalabilityCoordination

High-Level Architecture

Rendering diagram...

Design a system that generates unique IDs at scale in a distributed environment. IDs should be sortable by time, globally unique, and generated with minimal coordination between servers.

Clarifying Questions

  • ID format? (64-bit integer — fits in a long/bigint)
  • Must be time-sortable? (Yes, newer IDs > older IDs)
  • Generation rate? (10,000+ IDs per second per server, millions/sec total)
  • Single point of failure acceptable? (No — must be distributed)
  • Any ordering guarantee within same millisecond? (Not across servers, only within one server)