bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
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

This chapter

Overview
7

Lessons

14m

Read time

1. Design a News Feed: Requirements & Scope2. Design a News Feed: Capacity Estimation3. Design a News Feed: API & Data Model4. Design a News Feed: High-Level Architecture5. Design a News Feed: Scaling6. Design a News Feed: Deep Dive7. Design a News Feed: Tradeoffs & Review

On this page

How to approach itFan-out strategyApproaches