Design a Distributed Unique-ID Service
Issue globally unique identifiers at high volume while preserving uniqueness through concurrency, restarts, and regional failures.
Problem statement
Design a distributed service that generates unique identifiers at very large scale. For this exercise, assume internal product services in three regions request identifiers individually or in batches of at most 1000.
A successful response must contain fresh identifiers that will never be issued again, even after a worker restarts or a region fails. Clients treat identifiers as opaque strings; gaps are acceptable and global time ordering, secret tokens, and returning the same identifier on a retry are outside scope.
If the service cannot establish that a value is unused, it must return an explicit unavailable outcome rather than risk a duplicate. Explain how the system continues serving safely during partial failures and how it recovers capacity.
What to build
- For this exercise, authenticated internal clients request one to 1000 fresh identifiers and receive the complete batch or an explicit error.
- For this exercise, every successfully returned identifier is unique across concurrent requests, workers, regions, restarts, and retries. Unused identifiers may be discarded.
- For this exercise, return unavailable when safe identifier capacity cannot be established, and recover service without recycling previously issued or reserved identifiers.
At scale
- For this exercise, assume three serving regions generate 1000000 identifiers per second in aggregate, with bursts of 5000000 per second for five minutes.
- For this exercise, assume healthy same-region requests target p99 latency below 20 milliseconds and a service availability goal of 99.99%; uniqueness takes precedence when failures force a choice.
- For this exercise, assume identifiers remain in customer data for at least ten years, so recovery must not reuse the identifier space from an earlier process or restored control-plane state.