Back to sketch

SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 06

Design a microblog home timeline

Advanced · 45 min · Feeds & social graphs

People post short text updates and follow whoever they like. Opening the app shows a home timeline: the newest posts from everyone you follow. Most accounts have a few dozen followers, but a handful of public figures have more followers than most countries have people.

Requirements

  • Publish a post of up to 280 characters.
  • Follow and unfollow any account without approval.
  • Show a home timeline of posts from followed accounts, newest first, with pagination.
  • Show a user timeline of one account's own posts.

Constraints and assumptions

  • 250 million daily active users and 500 million new posts a day (about 6,000 per second, peaking at 20,000).
  • Home timeline reads peak at 300,000 per second; p99 under 200 ms.
  • The average account has 200 followers, the median about 50, and the largest has 150 million.
  • A post from an ordinary account should appear in followers' timelines within 5 seconds.
  • A home timeline shows at most the most recent 800 posts; older posts are reachable only through user timelines.

Out of scope for the first sketch

Ranking or recommendations (strictly reverse-chronological) · Search, trends and hashtags · Media attachments and direct messages

Draw your design

Rough math and notes

Done on paper? Compare with the worked approaches