Skip to content
SD-6 · System design

Design a Microblog Timeline

Asked at Mid level45 minutes
Our answers stay hidden until you reveal them.

Design a microblogging service. People post short text messages, called tweets here, follow other accounts, and read a home timeline: the newest tweets from everyone they follow. They can also open a profile, like and repost, and search recent tweets.

The service has 250 million daily users who load a timeline page about 35 times a day, and 430 million tweets are posted a day. Reads beat writes 20 to 1, and timelines must load in well under a second. The hard part is the follow graph: the average account has 200 followers, but a few have over 100 million, so “show every follower this tweet” is cheap for almost everyone and ruinous for a handful.

Good questions to ask first

Decide what you would assume for each before you look at ours.

  1. 1How long is a tweet?
  2. 2How is the home timeline ordered?
  3. 3How fresh must it be?
  4. 4How far back can you scroll?
  5. 5How big do accounts get?
  6. 6Can tweets be edited or deleted?
  7. 7Do we need reposts and likes?
  8. 8Is search in scope?

How to spend the 45 minutes

  1. 5minPart 1: Requirements and scope
  2. 5minPart 2: Estimates
  3. 5minPart 3: API
  4. 15minPart 4: Architecture, stage by stage
  5. 15minPart 5: Deep dives: fan-out, IDs, caches
Sketch your own design: boxes, arrows and the numbers that matter. Then compare it with ours.Break it in the labVisual walkthrough