CHAPTER 15

Design a News Feed

Fan-out on write vs read, the celebrity problem and ranking

Source: PDF p. 52

Core PDF content
Functional requirementsNon-functional requirements and scale
- Publish posts (text, media) - Follow / unfollow users - View a personalised home feed, scrolling with pagination - Likes and comments (counts shown on posts)- Feed load p99 < 300 ms - Highly available; eventual consistency of feeds is fine (seconds) - 200 M DAU, ~5 feed opens per user per day, avg 200 followers, some accounts with 50 M followers
QuantityEstimateDesign implication
Feed reads200 M x 5 = 1 B/day = ~11,500/s (peak ~35,000)Read-heavy: precompute and cache
Posts50 M/day = ~580/sWrites are modest
Fan-out writes (push)50 M x 200 followers = 10 B/day = ~115,000/sLarge but async; needs a queue and sharded cache
Feed cache200 M users x 800 post IDs x 8 B = ~1.3 TBStore IDs only, in Redis across a cluster
Celebrity post1 post x 50 M followersPushing 50 M inserts per post is infeasible: use pull
Figure 36. News feed architecture: precompute feeds on write for normal users, merge celebrity posts on read, rank, then hydrate. · PDF p. 52

Deep dive: push, pull or hybrid p. 52

Fan-out on write (push)Fan-out on read (pull)Hybrid (what large systems do)
Feed readFast: read a precomputed listSlow: query all followees' posts and mergeFast list + merge a few celebrity timelines
Post writeExpensive for users with many followersCheap: store oncePush for normal users; skip celebrities
StorageDuplicates IDs per followerMinimalModerate
ProblemsCelebrity storms, wasted work for inactive usersLatency spikes, heavy read loadMore moving parts
  • Ranking: candidate generation (recent posts from graph + recommended) followed by an ML ranker predicting engagement (like/comment/share/dwell) from features (author affinity, recency, post type, user history); then diversity and policy filters (Ch. 28).
  • Pagination: cursor = (score, post_id) so new posts do not shift pages. Cache the first page aggressively.
  • Counters (likes, views): very hot rows. Use sharded counters in Redis, async aggregation, and show approximate counts.
  • Media: upload to object storage, transcode, serve from CDN; the feed only carries URLs.

Review questions for this chapter have not been written and reviewed yet. The chapter text above is the full source content.

Try it

References

System Design & AI System Design: The Complete Guide — 2026 Edition, p. 52; figures 36.

Tip: use ← and → keys to move between chapters.