Guide

A news feed (home timeline) shows a user recent posts from the people they follow, optionally ranked. At small scale it is a simple query. At hundreds of millions of daily users, the hard problem is not storing posts. It is fan-out: getting each new post in front of the right readers fast enough that opening the app feels instant.

Meta's early feed systems and Twitter's timeline service are the real-world references. Facebook's TAO paper describes the social graph store that sits under the feed. Once you can explain why "query every followee on read" fails at this scale, the rest of the design follows.

In an interview, lead with hybrid fan-out before drawing many boxes. Interviewers listen for the write-amplification math, the celebrity threshold, timelines as derived data, cursor pagination, and media kept off the database.

Concepts in this section

StepConceptWhat it answers
1Requirements and estimatesWhat must the feed do, and how big is it?
2Fan-out on write and readWhere does the cost of delivering a post go?
3Timeline storageHow is each user's list of posts stored and read?
4Hybrid fan-out and celebritiesHow do you handle an account with 100 million followers?
5Feed rankingHow are candidates ordered, and how are repeats hidden?
6Timeline consistency, deletes and blocksWhat happens to posts that are deleted, blocked or muted?

Common mistakes

  • Designing pure push or pure pull. Push fails on celebrities, and pull fails at peak read volume. Propose the hybrid, then explain the threshold.
  • Treating timelines as the source of truth. Timelines are derived data. Keep posts durable and rebuild timelines when needed.
  • Walking the social graph on every feed load. Precompute timelines instead of joining the graph for each card.
  • Ignoring fan-out lag. When the backlog grows, feeds go stale. Alert on lag, scale the workers, and shed backfill work first.
  • Overloading one hot post key. A viral post can swamp one cache key. Replicate the post cache, serve media from a CDN, and avoid synchronous writes on every like.

Key takeaways

  • Feed latency is a read-path requirement. Meet it with precomputed timelines.
  • Fan-out cost, not storage, is the hard part. Do the write-amplification math early.
  • Use hybrid fan-out: push for ordinary authors, and merge celebrity posts on read.
  • Timelines store references. Post bodies come from a cache, and media from object storage and a CDN.
  • Rank in stages, and keep seen state and diversity rules explicit.

Further learning

A Meta engineer's mock interview designing Twitter shows how hybrid fan-out is explained under time pressure.

Design Twitter | Mock System Design Interview with a Meta Software EngineerPKodes

Jordan Hashemi's "Design Twitter" walkthrough covers estimates and the push and pull trade-off clearly.

Design Twitter - System Design InterviewNeetCode

ByteByteGo blog (Alex Xu) covers fan-out and caching patterns that come up in interviews.

Start with requirements and estimates.