Skip to content

Resource · Guide or article

Design the Twitter timeline and search

Designs the home timeline, user timeline and keyword search for a Twitter-like service; the page notes that Facebook feed and search questions are similar. It suits candidates preparing feed or fan-out questions who already know caching and SQL basics.

Reviewed

Open the original: Design the Twitter timeline and search (opens the original site in a new tab)

Practice this topicOpens the practice interviewer in System design mode; choose a question there.

Add to a roadmap

Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.

Source content: English

A worked system design exercise from “The System Design Primer”. Steps: Outline use cases and constraints; Create a high level design; Design core components; Scale the design.

PrepKit overview

PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.

Suited to
The source does not state a level
Format
Guide

What it covers

  • Takes assumed volumes of 500 million tweets a day with an average fan-out of 10 and derives about 60 thousand fan-out deliveries and 100 thousand reads per second.
  • Fans each new tweet out to followers' home timelines held in a memory cache, with a Redis list layout of tweet ID, user ID and metadata.
  • Reads the home timeline from the cache, then fills in tweet and user details with multiget calls.
  • Routes search through query parsing and a scatter-gather over a Lucene-style search cluster.
  • Discusses the slow fan-out for accounts with millions of followers and merging their tweets at read time instead.

How to use it

PrepKit study advice, not a claim made by the source.

Explain the trade-off between pushing tweets at write time and pulling them at read time, using the page's own fan-out estimate. Then draw the post and home timeline paths and mark where you would cap cache size.

Scope and limitations

One possible design based on the exercise's own assumptions, which may not reflect how the real service works today. Visibility rules, the Firehose and analytics are out of scope. The scatter-gather link points to a section marked under development, and the diagrams are external images.

Access and format

README on GitHub in the donnemartin/system-design-primer repository by Donne Martin, licensed CC BY 4.0. English, free to read online.

Reviewed by PrepKit on Oct 2, 2026. Listing source commit: ae9bbd7b02d9

Evidence behind this overview
  • solutions/system_design/twitter/README.md

Pages that include this

Get the PrepKit newsletter

Optional. You don't need it to use PrepKit.

How we handle your email