Preview — Pro guide
You are seeing a portion of this guide. Sign in and upgrade to unlock the full article, quizzes, and interview answers.
Sections
Related Guides
Design Twitter/X Feed (News Feed)
High-Level Design
Caching: Strategy, Redis Internals & Distributed Patterns
High-Level Design
Message Queues & Streaming: Kafka, Delivery Semantics, and Consumer Groups
High-Level Design
Databases: Sharding, Indexing & Replication
High-Level Design
Distributed Systems Patterns
High-Level Design
News Feed Architecture: Fan-Out on Write vs Read, Hybrid Strategies & Feed Ranking
The fan-out problem is the central challenge behind every social feed — Twitter, Instagram, Facebook, LinkedIn. Master fan-out on write (push), fan-out on read (pull), the hybrid approach for celebrity accounts, feed storage in Redis, Cassandra schema design, and how feed ranking layers on top of chronological ordering.
The Fan-Out Problem: Why News Feeds Are Hard
A news feed sounds simple: show User A the recent posts from all accounts User A follows, in reverse-chronological order (or ranked order). The implementation at scale is one of the most instructive distributed systems design challenges because it forces an explicit choice between two fundamentally opposed strategies — and neither works cleanly at scale.
The core tension: When User A posts, do you push the post to all their followers immediately (fan-out on write), or do you pull all followed accounts' posts when a follower opens their feed (fan-out on read)?
At Facebook's scale: 3 billion users, average 338 friends per user. A single post write triggers up to 338 feed insertions. Cardi B (145M Instagram followers) posting a photo triggers 145M simultaneous writes. Neither pure push nor pure pull handles this well — the industry solution is a hybrid that most candidates don't know.