Skip to content
HLD Learn/Real-Time Systems

Fan-out Strategies for Feeds

5 min read

You'll learn to

  • -Compare fan-out-on-write and fan-out-on-read

Fan-out on Write (Push)

The moment someone posts, the system immediately copies that post into every one of their followers' precomputed feed lists. Reads are then extremely cheap: just fetch the already-assembled list. The catch is the "celebrity problem": a user with 50 million followers turns one post into 50 million writes.

Fan-out on Read (Pull)

Nothing is precomputed. When a user opens their feed, the system fetches recent posts from everyone they follow and merges them on the spot. Writes stay cheap no matter how many followers someone has, but reads get expensive for a user who follows thousands of accounts.

The Hybrid Approach

Most large-scale feed systems use both: push (fan-out on write) for ordinary accounts, and pull (fan-out on read, merged in at request time) specifically for celebrity accounts whose follower count would make push prohibitively expensive. This is exactly the kind of "know the access pattern, then pick per-case" trade-off this course keeps returning to.

Regular User Posts
Celebrity Posts
Fan-out Worker
Follower Feed Cache
Reader

Regular users are fanned out on write for fast reads; celebrity posts are pulled and merged in at read time instead.

Regular User PostsFan-out Worker- fan-out on writeFollower Feed CacheReader- precomputedCelebrity PostsReader- pulled + merged at read time

The Capstone module later in this course walks through a full news feed design end to end: real follower-count math, the exact write-amplification numbers, and the hybrid threshold logic in detail.

Interview Signal

Why is fan-out-on-read actually fine for a celebrity's followers, when fan-out-on-write for that same celebrity would be a disaster?

Weak Answer

"Because pull is generally more efficient than push."

Strong Answer

"It's specifically about which side of the relationship pays the cost. Fan-out-on-write cost scales with the poster's follower count, unbounded for a celebrity. Fan-out-on-read cost scales with how many accounts the READER follows, which is naturally bounded (a person only follows so many accounts, celebrity or not). Pulling a celebrity's posts at read time costs each reader one extra bounded lookup; fanning them out on write costs the system tens of millions of writes for a single post."

Check Yourself1 / 3

Which technique provides true bidirectional, low-latency communication?

Ready to Build This?

Level 10 (News Feed) and Level 11 (Chat System) are this module's two flagship exercises.

ScaleDojo Logo
Initializing ScaleDojo