08
Instagram News Feed
Ranked feed with cursor pagination. No `OFFSET`.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 Instagram News Feed
Ranked feed with cursor pagination. No `OFFSET`.
- Difficulty
- intermediate
- Time
- about 45 minutes
- Stages
- 10
- Topic
- Feeds, Timelines, Counters & Ranking
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
- TAO: Facebook's Distributed Data Store for the Social Graph (USENIX ATC '13)
- Scaling Memcache at Facebook (NSDI '13)
- f4: Facebook's Warm BLOB Storage (OSDI '14)
- An Analysis of Facebook Photo Caching (SOSP)
Build the primitives this design leans on
Each one is an animated curriculum that constructs the system from scratch.
- Build Build KafkaA partitioned, replicated, append-only log. The log is the database — internalize that, and a dozen product designs get easier.
- Build Build RedisAn in-memory data-structure server: one thread, rich types, optional persistence, async replication. Internalize the cost of single-threaded simplicity and a dozen caching/HA decisions get easier.
- Build Build a distributed search engine (Elasticsearch / OpenSearch style)Five million books, a search box, and a 100 ms budget. Build the engine from the inverted index up — segment, refresh, shard, replica, scatter-gather, BM25 — and feel why every guarantee that lives across shards is paid for in either an extra round trip or a small lie about the rankings.
- Build Build a CDNA globally-distributed reverse proxy whose only job is to (a) terminate the user's TCP/TLS milliseconds away and (b) serve a cached origin response so origin never sees the request. Internalize edge caching, anycast, TTL, revalidation, SWR, purge, the Vary footgun, origin shield, bypass, and hit ratio — and the dozen ways to misconfigure each.
More in Feeds, Timelines, Counters & Ranking
What to show and in what order: fanout on write versus read, hot/top/new scoring, approximate counters, trending, and recommendation.
- Twitter / X TimelinePush or pull? Both. The canonical fanout problem.
- Reddit / Hacker NewsVote-driven ranking with hot/top/new at scale.
- Like Button at ScaleEventual consistency, but the liker sees their own write. Counts are approximate by design; hot keys are the real enemy.
- View Count on a Video/PostDedup, bot-filter, batched aggregation.
- Trending TopicsSliding windows + Count-Min Sketch + top-K.
Browse the full problem catalog, or see what the simulator does and does not model.