Requirements for Unique Identifiers
Why this matters: these four requirements are the scorecard. Every approach in this chapter gets marked against them, and the comparison table that results is the most useful artifact here.
Key takeaway
Four requirements: uniqueness, scalability (at least one billion IDs per day), availability, and a 64-bit numeric ID. The last one is the constraint that eliminates the most obvious solution.
The four requirements
| Requirement | What it demands |
|---|---|
| Uniqueness | Assign distinct identifiers to every event — not probably distinct, distinct |
| Scalability | Generate at least one billion unique IDs per day |
| Availability | Events can occur at the nanosecond level; the system must generate IDs for all of them |
| 64-bit numeric ID | Restrict length to 64 bits for efficient storage and indexing |
Why 64 bits is enough
The arithmetic, which is worth being able to do live:
Total numbers available = 2^64 = 1.8446744 * 10^19
Estimated events per day = 1 billion = 10^9
Events per year = 365 billion = 365 * 10^9
Years to deplete the range = 2^64 / (365 * 10^9)
~= 50.54 million years
64 bits provide sufficient longevity for the system.
Reading the scorecard
Each approach in this chapter is scored against these four (and later a fifth, causality maintained). The table grows as the chapter progresses:
| Unique | Scalable | Available | 64-bit numeric ID | |
|---|---|---|---|---|
| The target |
Nothing satisfies all four until Lesson 5. Watching each approach fail a specific column is the fastest way to understand why the next one exists.
Key takeaway
Four requirements, and the binding one is size. A 64-bit budget is what forces the design to choose between coordination and cleverness.
Interview signal by level
| Level | What a strong answer sounds like |
|---|---|
| L4 | "It needs to be unique and scalable." |
| L5 | Quantifies: "a billion a day, 64-bit so it indexes efficiently as a primary key." |
| Staff+ | Identifies the binding constraint: "the size limit is what makes this hard — without it UUIDs solve everything. I'd confirm the limit exists before designing, because it changes the answer entirely. And 64 bits at a billion a day is fifty million years, so we're not constrained by exhaustion." |
Next: the obvious solution, and why it fails.