Problems / Design a product, hard

Build Instagram: the full interview

Design Instagram the way a senior interview expects: uploads processed in the background, posts fanned out into precomputed timelines (with celebrities pulled at read time), a ranked feed with a fallback, stories that expire, hot counters, and media through a CDN.

Unlock it once for 25 credits; everything inside it is free (runs, changes, Submit, results, hints). Sign in with Google to start; new accounts get free credits.

What it must do

Scale

Request types to route: media (40%, read), feed (25%, read), stories (12%, read), engage (12%, write), profile (8%, read), post (3%, write). Budget: $26,000 a month.

Estimate first

The test cases

You start from an empty canvas. When you run the tests, each one simulates your design with its own traffic and failures:

TestWhat it doesPasses when
Normal dayThe normal day: the traffic in the brief, nothing broken.Success ≥ 99.9%; p99 latency ≤ 250 ms (feed); p99 latency ≤ 200 ms (media); Success ≥ 99.8% (post)
A celebrity postsAt 5 s an account with over 100 million followers posts. For 8 s traffic triples: followers refresh their feeds, open the profile and like the post, so one like counter takes a large share of every like.Success ≥ 99%; Success ≥ 99% (engage); p99 latency ≤ 500 ms (feed)
Timeline cache flushedAt 5 s the first application cache on the request path (the timeline cache) is emptied, as after a bad deploy or a cluster restart: every feed load misses until it warms up.Success ≥ 99%; p99 latency ≤ 400 ms (feed)
Media CDN purgedAt 5 s the media CDN is purged (a bad cache-key change, or a new edge region coming up cold): every photo and video fetch goes to the origin until the CDN warms up.Success ≥ 99%; Success ≥ 99% (media); p99 latency ≤ 500 ms (media)
Ranking model 10× slowerAt 5 s the feed ranking model answers 10× slower for 8 s, as after a bad model push or lost inference hosts.Success ≥ 99% (feed); p99 latency ≤ 450 ms (feed)
A server diesAt 4 s one server of the first app service on the request path dies for 10 s.Success ≥ 99%; p99 latency ≤ 400 ms (feed)
ScrapersAt 5 s 6,000 requests a second of scraping traffic arrive for 10 s, alongside real users.Attack blocked ≥ 90%; Success ≥ 99%
Fan-out stream crashesAt 5 s the stream that carries new posts to the fan-out workers crashes and takes 10 s to restart. Posts made meanwhile must still reach their followers’ feeds.No lost events; Success ≥ 99% (post)
Budget: $26,000/monthThe normal day's design must cost at most $26,000 a month.Cost ≤ $26,000/month

Must include

More design a product problems