MentorNode
Start free
Social, Feed & EngagementHarddesign-news-feed

Design a News Feed (Facebook / X Timeline)

Design the timeline: assemble a personalized, ranked feed in under 200ms for users who follow thousands of accounts, some of which have 100 million followers.

Fanout on WriteFanout on ReadHybrid FanoutFeed RankingPagination Cursors
Traffic & Capacity Estimates:

300M DAU · 10B feed reads/day · 500M posts/day · p99 under 200ms

Functional Requirements

  • •Return a ranked, paginated feed of posts from accounts a user follows.
  • •Reflect a new post in followers' feeds within seconds.
  • •Support cursor pagination that is stable while new content arrives at the head.
  • •Blend in recommended and sponsored content without breaking the ranking contract.

Non-Functional Requirements

  • •Feed assembly p99 under 200ms including ranking.
  • •A celebrity post must not stall the write path for ordinary users.
  • •Feed must degrade gracefully to reverse-chronological when the ranker is unavailable.

Back-of-the-Envelope Math

  • 500M posts/day with an average 200 followers = 100B feed-entry writes/day under pure fanout-on-write.
  • A 100M-follower account posting once would generate 100M writes — which is precisely why the hybrid exists.

Key Architectural Trade-offs

  • Fanout on write (precomputed feeds, instant reads, catastrophic for celebrity accounts) vs fanout on read (cheap writes, expensive scatter-gather on every view).
  • The hybrid — precompute for normal accounts, merge celebrity posts at read time — is what production systems run, and it doubles the code paths.
  • Ranking at read time is fresh and costly; precomputed ranked feeds are fast and stale, and users notice the difference within minutes.

Click or drag a component onto the canvas, then connect the handles to draw the data flow.

3 nodes · 2 edges

Components · 35

Client & Edge4
Compute & Gateway7
Storage & Caching11
Messaging & Streaming6
Coordination & Ops5
Intelligence2
Canvas overview