Skip to main content

Preview — Pro guide

You are seeing a portion of this guide. Sign in and upgrade to unlock the full article, quizzes, and interview answers.

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.

35 min read 2 sections 1 interview questions
News FeedFan-OutFan-Out on WriteFan-Out on ReadRedisCassandraSocial GraphTimelineFeed RankingPush vs PullCeleb ProblemFanout QueueKafkaFeed StorageSocial Media Architecture

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.

IMPORTANT

Premium content locked

This guide is premium content. Upgrade to Pro to unlock the full guide, quizzes, and interview Q&A.