Course map

Project 13

Social media feed

Feed generation and fan-out

Start after Part 7

Key topics 75, 87, 99

Architecture Services

Published reference Twitter, "Timelines at Scale" (Raffi Krikorian, QCon San Francisco 2012; talk hosted on InfoQ)

Brief

Follow users, post content, read a home feed; likes and counts; media served via CDN.

Targets

10M DAU · feed load p99 < 200 ms · a new post visible to followers within 30 s · celebrity accounts with 10M followers handled.

Must cover

  • Fan-out choice and very popular accounts — the hybrid decision with arithmetic (→ 99).
  • Ranking basics — a pluggable scoring boundary over the chronological core (P).
  • Privacy filtering — blocked users and private accounts enforced at read time (P).
  • Moderation hooks — takedowns propagate to pushed feed copies (P).

Design challenges

  1. The fan-out decision (→ 99): fan-out on write (push to follower feed caches) vs. fan-out on read (merge at request time) vs. the hybrid — push for normal users, pull for celebrities — with cost arithmetic at the stated scale (→ 20).
  2. Feed storage (→ 87): sorted sets per user — memory sizing, truncation, cold-user rebuild.
  3. Counters at scale (→ 88): sharded counters, eventual accuracy, cached display values.
  4. Sortable, decentralized post IDs (→ 75).
  5. Deletion and moderation propagating through pushed copies (→ 129).
  6. Read-your-own-post consistency while followers get eventual (→ 129).

Out of scope

ML ranking (→ 216), stories and video pipelines (Project 18).

Search the guide