Design of a Unique ID Generator
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 sufficient longevity for the system.
Let’s evaluate different approaches (solutions) for generating IDs.
First solution: UUID
A