{
  "id": 19075952,
  "title": "How Twitter Scales Its Home Timeline: Fan-Out on Read vs Fan-Out on Write",
  "url": "https://urgent.news/2026/11/09/how-twitter-scales-its-home-timeline-fan-out-on-read-vs-fan-out-on",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-09T03:09:39.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/kevinrawal/how-twitter-scales-its-home-timeline-fan-out-on-read-vs-fan-out-on-write-kkg"
  },
  "original_language": "en",
  "account": "Twitter faces the challenge of efficiently generating home timelines for millions of users, each following a unique set of accounts with varying numbers of followers. The solution involves two main strategies: Fan-Out on Read and Fan-Out on Write.\n\nThe Fan-Out on Read approach, also known as the pull model, generates timelines each time a user requests them. When a user opens their timeline, the system fetches the list of accounts they follow, retrieves recent tweets from those accounts, merges and sorts them by timestamp, and returns the timeline. This method is advantageous because publishing tweets is relatively cheap, and updates to individual timelines aren't required when someone publishes a tweet. However, it has disadvantages such as high read traffic, which can strain the system, and expensive merging and sorting of tweets during each request.\n\nConversely, the Fan-Out on Write approach, or push model, prepares timelines when tweets are published. When an account publishes a tweet, a fan-out worker finds all the follower accounts and pushes the tweet ID into each follower's home timeline cache. When a follower opens Twitter, they simply fetch their precomputed timeline. This method is beneficial for read-heavy applications because reading timelines becomes extremely fast, as most of the computation happens during publishing. However, it is expensive for publishing, particularly for accounts with millions of followers, as a single tweet can trigger millions of writes, creating substantial write amplification.\n\nTwitter addresses this challenge by implementing a hybrid approach. Normal accounts, who don't have millions of followers, use the Fan-Out on Write strategy. Precomputed timelines are generated for each follower's timeline when a tweet is published. Celebrity accounts, with millions of followers, utilize the Fan-Out on Read strategy. Instead of pushing tweets into millions of follower timelines, these accounts' tweets are fetched only when followers request their timelines. When a user opens their timeline, the system fetches their precomputed timeline and merges it with recent tweets from celebrity accounts they follow. This hybrid approach balances the costs of reading and writing, optimizing for different user workloads and traffic patterns.",
  "summary": "Imagine opening Twitter (now X). Your home timeline shows tweets from hundreds or thousands of accounts you follow, sorted by time. Seems simple, right? But think about the scale: Millions of users accessing their timelines. Millions of tweets being published. Every user follows a different set of accounts. Some accounts have millions of followers. How do you generate everyone's timeline…",
  "key_points": [
    "Twitter uses Fan-Out on Read for normal accounts, Fan-Out on Write for celebrity accounts",
    "Fan-Out on Read generates timelines on user request, Fan-Out on Write generates on tweet publication",
    "Hybrid approach merges precomputed timelines with recent tweets from celebrity accounts"
  ],
  "editors_take": "Twitter's hybrid architecture optimizes system performance by shifting the computational burden between publishing and reading to accommodate the vastly different scaling needs of regular users and celebrity accounts.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}