Problems / Design a product, easy
Design bit.ly from an empty canvas: create short links and redirect them, fast, at 2,000 requests a second.
Free to open. Sign in with Google to start; new accounts get free credits.
Request types to route: redirect (95%, read), shorten (5%, write). Budget: $1,500 a month.
You start from an empty canvas. When you run the tests, each one simulates your design with its own traffic and failures:
| Test | What it does | Passes when |
|---|---|---|
| Normal day | The normal day: the traffic in the brief, nothing broken. | Success ≥ 99.9%; p99 latency ≤ 100 ms (redirect) |
| A link goes viral | At 5 s a link goes viral: traffic triples for 8 s. | Success ≥ 99%; p99 latency ≤ 250 ms (redirect) |
| Cache flushed | At 5 s the cache on the request path is emptied, as after a restart or a bad deploy. | Success ≥ 99% |
| A server dies | At 4 s one server of the first app service on the request path dies for 10 s. | Success ≥ 99% |
| Budget: $1,500/month | The normal day's design must cost at most $1,500 a month. | Cost ≤ $1,500/month |
Try it first. Open one hint at a time if you get stuck.
Start where traffic enters: a load balancer in front of a stateless API.
Redirects are reads of a few hot keys: look them up in a cache first, and go to the database only on a miss.
New links are writes: send them straight to a key-value store keyed by the short code.
Give the API at least 3 replicas so one can die, and size the store for the reads the cache misses.
Load balancer → API (3–4 replicas) → Redis cache for redirects (miss → key-value store); new links written to the key-value store, optionally with an ID generator for the short code.