Design a News Feed – Design
10 min · Step: design
Design a News Feed – Design
For a read-heavy feed at moderate scale (e.g., 1M DAU):
High-Level Architecture
-
Post service: Creates and stores posts (DB: PostgreSQL or similar).
-
Graph service: Tracks follow relationships.
-
Feed service: Builds timelines. Options:
- Pull (fan-out on read): Fetch posts from followed users on each request. Simple, but slow for heavy follow graphs.
- Push (fan-out on write): Precompute feed per user when new posts arrive. Fast reads, expensive writes.
-
Cache: Redis for hot feeds.
Inline Check 1
When is fan-out on read (pull) acceptable?
<!-- quiz-candidate: true -->