Follow The Fan-Out

Design the home timeline for a Twitter/X-style social network.

Requirements

Functional:

  • Users follow and unfollow other accounts.
  • Users publish short text posts, optionally with one attached image.
  • Users open a home timeline of recent posts from the accounts they follow, newest first, paginated.
  • A post from a normal account should reach its followers' timelines within a few seconds.

Non-functional:

  • Timeline read latency p99 under 200 ms server side.
  • 99.95 percent availability on the read path. A slightly stale timeline beats an error.
  • Ordering is strictly reverse chronological. There is no ranking model yet.

Scale

  • 300M registered accounts, 150M daily actives.
  • 45M posts per day, about 520 writes/sec average and 1.6k/sec at peak.
  • 1.2B timeline reads per day, about 14k reads/sec average and 40k/sec at peak.
  • The median account follows 200 others. The largest accounts are followed by 10M to 100M people.
  • Text payload averages 300 bytes. Roughly 10 percent of posts carry a 500 KB image.
  • Growth of about 8 TB per year in post rows and 800 TB per year in media.

Out of scope

Direct messages, notifications, search, trending topics, ads, moderation tooling, and ML ranking.