...

>

Design of a Unique ID Generator

Design of a Unique ID Generator

Define the requirements for a high-throughput, 64-bit unique ID generator in distributed systems. Analyze the architectural trade-offs of UUIDs, database sequencing, and the range handler pattern. Learn to choose a scalable solution that ensures uniqueness and availability in complex System Design.

The previous lesson discussed use cases for unique identifiers, such as labeling tweets or tracking execution flow. This lesson explores system designs for generating these IDs. We will compare UUIDs, databases, and range handlers against the requirements defined below.

Requirements for unique identifiers

Our proposed system must meet the following requirements:

  • Uniqueness: Assign distinct identifiers to every event.

  • Scalability: Generate at least one billion unique IDs per day.

  • Availability: As multiple events can occur at the nanosecond level, the system should generate IDs for all events.

  • 64-bit numeric ID: Restrict length to 64 bits for efficient storage and indexing. This size provides sufficient capacity for many years, for example:

64 bits provide ...