# Design a distributed unique ID generator: system design interview question

> A high-throughput ID service with a fixed bit limit, clock faults, safe process restarts, and regional failures.

Source: https://sysround.com/questions/design-distributed-unique-id-generator
Updated: 2026-11-05


Difficulty: hard. Levels: Mid-level, Senior, Staff+.

## How the interviewer opens it

"Design a service that generates globally unique, roughly time-ordered identifiers. It must support high throughput without a central bottleneck."

## What to clarify first

- ID format and service life
- Scale
- Request mix
- Order
- Latency
- Consistency and availability
- Durability
- Retries and gaps
- Failure conditions
- Scope limits

## Scope of a strong answer

Core requirements:

- Allocate one ID or a batch of IDs
- Prevent duplicate IDs across regions, crashes, and process restarts
- Return roughly time-ordered IDs within a positive signed 64-bit integer
- Support high throughput without shared coordination for each ID

Usually out of scope:

- Strict global order
- Gap-free IDs
- Exactly-once allocation across client retries
- Storage of the business records that use the IDs

## What interviewers probe

### ID size and order

A fixed 64-bit value must support the service life, the process count, the peak rate, and approximate time order.

### Clock changes

Clock changes can repeat an earlier ID range or move IDs far outside the permitted time order.

### Process restarts and region failures

A replacement and an old process can both remain active. Lease expiry alone does not prevent them from issuing the same ID.

## Common mistakes

- The design contacts one shared counter for every ID.
- The design uses random 64-bit values without a collision bound.
- The design resets the sequence after a clock retreat.
- The design reuses a process identity after lease expiry without a rule for old owners.
- The design promises strict global order and full availability during a region split.
- The design ignores the bit limit or the batch request rate.

## The bar by level

- **Mid-level:** Defines a valid bit layout, API, and local allocation path. Handles concurrent requests, sequence exhaustion, and basic clock retreats. Explains how workers receive unique identities.
- **Senior:** Proves safety across restarts and stale owners. Keeps coordination outside the per-ID path. Quantifies capacity and defines rejection behavior for unsafe clocks and partitions.
- **Staff+:** States invariants for each process incarnation and timestamp interval. Proves safety during pauses, replacements, and partitions. Balances reservation duration, recovery delay, spare slots, and regional availability.

Practice this question with an AI interviewer: https://sysround.com/practice/new?problem=distributed-unique-id-generator


---
SysRound (https://sysround.com) is an AI practice tool for system design interviews. It has a voice or typed AI interviewer and a shared whiteboard. At the end, you get feedback on each skill and a model answer. The AI feedback can be wrong.
