03
Distributed Unique ID Generator
Generate globally unique, monotonic-ish IDs at scale.SavedSaved on this device — Saved on this device
01Clarifications
What would you ask before drawing a single box?
Ambiguity you would resolve with the interviewer: scope, scale, who uses it, what counts as done.
AI staff engineer
Enter to send · Shift+Enter for a new line
About Distributed Unique ID Generator
Generate globally unique, monotonic-ish IDs at scale.
- Difficulty
- intermediate
- Time
- about 50 minutes
- Stages
- 10
- Topic
- System Design Fundamentals
How this problem is worked
Ten stages, from the questions you would ask an interviewer to the trade-offs you would defend. Each asks one question, and the simulator runs the architecture you draw against the requirements you wrote.
- 01ClarificationsWhat would you ask before drawing a single box?
- 02Functional reqsWhat must this system actually do?
- 03Non-functionalWhat must it promise about speed, uptime and correctness?
- 04Capacity estimationHow much load and data does this have to hold?
- 05API designWhat does the outside world call, and what comes back?
- 06Data modelWhat gets stored, and what is it looked up by?
- 07Use-case breakdownHow does each requirement actually get served?
- 08High-level designWhich components handle a request, and in what order?
- 09Deep divesWhich part breaks first, and what do you do about it?
- 10Trade-offsWhat did this design cost, and what breaks at 10×?
Primary sources for this problem
- Twitter Engineering — Announcing Snowflake (2010)
- Discord — How Discord Stores Trillions of Messages (snowflake layout)
- Instagram Engineering — Sharding & IDs at Instagram (PG PL/pgSQL next_id)
- Flickr Code — Ticket Servers: Distributed Unique Primary Keys on the Cheap
- Meituan Tech — Leaf: open source ID-gen (segment + snowflake, 双 buffer)
- RFC 9562 — Universally Unique IDentifiers (incl. UUIDv7)
- Sony — Sonyflake (39-bit 10ms-tick + 16-bit machine-id)
- Cloudflare — How and why the leap second affected Cloudflare DNS (2017)
- Meta Engineering — NTP service migration (chrony, 100µs precision)
- Jepsen — MySQL 8.0.34 (semi-sync replication and binlog freshness)
- PlanetScale — MySQL semi-sync: durability, consistency, split-brains
- Shopify Engineering — Building Resilient Payment Systems (ULID vs UUIDv4)
- Stripe Blog — Designing robust and predictable APIs with idempotency
- Google SRE Workbook — Ch. 22 Addressing Cascading Failures
- AWS Builders' Library — Timeouts, retries, and backoff with jitter
More in System Design Fundamentals
The four primitives every later problem assumes — unique IDs, rate limits, caching a read-heavy endpoint, and making a retry safe.
- URL ShortenerShorten a long URL. Read-heavy. Don't collide.
- PastebinStore text/code blobs with TTL and access control.
- Distributed Rate LimiterEnforce a per-key request limit across a fleet of enforcers — accurately, in under a millisecond, without becoming the outage.
- Submit Order (Prevent Double-Charge)Idempotency keys, dedup window, retry storms.
Browse the full problem catalog, or see what the simulator does and does not model.