SD System Design In Depth
0%
lesson system-designsocialfeeds

Feed generation: push, pull, hybrid

Module 4.4: Real-Time Messaging & Feed Architectures Updated Sep 18, 2026
📄 Cheat Sheet
Design FB News Feed System Design Interview w/ ex: Meta Senior Manager
Hello Interview Design FB News Feed System Design Interview w/ ex: Meta Senior Manager Watch on YouTube ↗

A focused news-feed design that spends its depth on exactly fan-out on write versus read, the celebrity problem and the hybrid solution.

0:00 / --:--

Designing a News Feed

Generating a timeline of content from people a user follows is a classic system design challenge. The core decision is how content moves from a creator to a consumer's feed.

Push Model (Fan-out on Write)

When a user posts, the system immediately "pushes" the post ID into the pre-computed feed caches of all their followers. When a follower opens the app, their feed is already built and stored in memory (e.g., a Redis List).

Pros: Reads are fast and bounded: a range read of one precomputed page plus hydration and ranking, rather than a merge across every followed account.

Cons: The "Justin Bieber Problem." If a celebrity with 100 million followers makes a post, the system must write to 100 million Redis lists. This massive fan-out takes time, consumes enormous CPU/Network, and delays feed updates.

Pull Model (Fan-out on Read)

When a user posts, it is simply saved to their personal outbox. No feed updates are made. When a follower opens the app, the system queries the outboxes of all people they follow, merges the posts, sorts them by timestamp, and returns the result.

Pros: Writes are instant. No celebrity fan-out issue.

Cons: Reads are slow and computationally expensive, especially for users who follow thousands of people.

The Hybrid Approach

Modern systems use a hybrid model. For normal users, the system uses Push (fan-out on write) to keep feeds fast. For celebrities or highly active accounts, the system uses Pull. When you load your feed, the system grabs your pre-computed Push feed, then dynamically Pulls recent posts from the celebrities you follow, and merges them together at read-time.

Worked example: the numbers behind the hybrid

Assume 300 million daily users, an average of 200 followers per author, and 50 million posts per day.

  • Pure push: 50M posts x 200 followers = 10 billion timeline inserts per day, about 116,000 per second on average and several times that at peak. Storing 800 post IDs of 8 bytes for 300M users is about 1.9 TB of timeline data (before replication), which fits in a large Redis or Cassandra cluster.
  • A celebrity post: one account with 100 million followers needs 100 million inserts. Even at 1 million inserts per second across the cluster that is 100 seconds of lag and a burst that starves everyone else's fan-out.
  • Pure pull: a user following 500 accounts triggers 500 outbox reads (or scatter-gather over many shards) plus a merge on every feed open; at 175,000 feed opens per second that is tens of millions of reads per second.
  • Hybrid: push for authors under a threshold (say 100,000 followers), pull for the rest. A typical user follows perhaps 10 to 20 such large accounts, so a read is one precomputed list plus 10 to 20 small, heavily cached outbox reads, merged by time or score.

Trade-off table

DimensionPush (fan-out on write)Pull (fan-out on read)Hybrid
Write cost per postProportional to follower countOne writeProportional to followers for normal authors only
Read latencyLowestHighest; merge of many sourcesLow; small merge
StorageTimeline per userOutboxes onlyBoth
FreshnessLags behind large fan-outsAlways freshFresh for celebrities, near-fresh for others
Wasted workFan-out to users who never open the appNoneReduced by skipping inactive users
flowchart LR P["New post"] --> T{"Author above follower threshold?"} T -- "no" --> FO["Fan-out workers insert post id into follower timelines"] T -- "yes" --> OB["Store in author outbox only"] R["Feed read"] --> M["Merge precomputed timeline with celebrity outboxes"] FO --> M OB --> M M --> RK["Rank, filter deleted and blocked, hydrate"]

How real systems do it

  • Twitter (as described by Raffi Krikorian in 2012 to 2013) fanned out tweet IDs into Redis home timelines capped at about 800 entries, and very large accounts could take minutes to fan out, which is what motivated merging celebrity tweets at read time.
  • Facebook News Feed is largely pull-and-rank: candidates are gathered from friends and pages at read time and scored by ranking models, because ranking needs fresh features anyway.
  • Instagram used push-based feeds stored in Cassandra, then layered ranking over the candidate set.
Check yourself Question 1 of 3
Hybrid read path recall
From: Designing a News Feed

In the hybrid feed model, what does the system do when a user who follows several celebrities opens their feed?

Feed Fan-out Calculator

Push Model (Write Fan-out)

Writes/sec: 0

Reads/sec: 0

Pull Model (Read Fan-out)

Writes/sec: 0

Read Amplification: High (Compute intensive)

Key Takeaways

Push (fan-out on write) optimizes for fast reads but struggles with massive follower counts.
Pull (fan-out on read) optimizes for fast writes but slows down feed loading.
Hybrid models apply different strategies based on user follower topology.
Was this lesson helpful? Spot an issue or have a suggestion? Let us know on GitHub.
Report an issue