Skip to content

News Feed — Notes#

Functional#

  • User can post text/media.
  • Follow graph (asymmetric).
  • Each user gets ordered feed of followees' posts.
  • Pagination, freshness, ranking, hide/mute.

Non-functional#

  • p99 feed open < 200 ms.
  • Hot-celeb posts visible in seconds.
  • 1B users, avg 200 followees, avg 10 posts/day.

Capacity#

  • Posts/day: 1B × 10 ÷ 5 (5% post) = 2B posts/day → 23k/s avg.
  • Fan-out writes: 2B × 200 (avg followers) = 400B/day = 4.6M/s.
  • Storage: 2B × 1 KB × 365 d = 730 TB/yr.
  • Timeline cache: 1B users × 1k posts × 16 B ≈ 16 TB (Redis cluster).

API#

POST /v1/posts
GET  /v1/feed?cursor=...&limit=20
POST /v1/follow/{user}

Trade-offs#

  • Push great for normal users; useless for Justin Bieber.
  • Pull great for celebs; bad for normal users (scatter).
  • Hybrid is universal; complexity in merge step.
  • ML ranking boosts engagement but adds compute + ethics surface.
  • Strong vs eventual ordering — usually eventual is fine; users tolerate seconds.

Refs#

  • Twitter timeline blog series, Facebook TAO paper, Instagram engineering posts, ByteByteGo "News Feed" video, Grokking SDI, Alex Xu Vol 2.