bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

Learn/System Design/Design a News Feed
System Design•Design a News Feed

Design a News Feed: Deep Dive

Design a home timeline (Twitter/Instagram style) that shows recent posts from accounts a user follows.

How to approach it

Every system has one signature hard problem the interviewer wants to watch you reason about. Identify it, lay out two or three approaches with their tradeoffs, and recommend one with a clear justification. Depth on the core problem beats breadth across components.

Fan-out strategy

Materialize each user’s home timeline cheaply despite power-law follower counts.

Approaches

ApproachTradeoff
Fan-out-on-write (push)fast reads, but a celebrity post writes to millions of timelines
Fan-out-on-read (pull)cheap writes, but reads must merge many authors at request time
Hybridpush for normal accounts, pull-merge for a small set of celebrities

Tip

Recommended — Hybrid: push to precomputed timelines for normal authors, and merge celebrity posts at read time from a small hot set.

Previous

Design a News Feed: Scaling

Next

Design a News Feed: Tradeoffs & Review