Limited Offer

30% OFF Lifetime Access ($139) with code SYSTEM30

TOPIC #263Advanced 12 min read

Twitter / X: Real-Time Timeline Generation & Fan-Out Architectures

💡
Core Architecture Summary

Architect real-time social streams: Timeline service, Tweet ingestion, Fan-out on Write vs Read, Redis In-Memory timelines, and Snowflake IDs.

Key Glossary Concepts in this TopicAll Glossary Terms

01.1. The Real-Time Feed Problem: User Timeline vs Home Timeline

Twitter (now X) operates under extreme read-heavy velocity, processing over 500 million tweets per day with traffic surges exceeding 150,000 tweets per second during global live events (such as the World Cup).

To architect this, Twitter divides feeds into two fundamentally different constructs:

  1. User Timeline (My Tweets): All tweets posted by a single specific user. This is trivial to serve via a sharded index lookup: SELECT tweet_id FROM tweets WHERE user_id = ? ORDER BY timestamp DESC LIMIT 20.
  2. Home Timeline (Followed Feed): The real-time composite stream of all tweets posted by everyone a user follows. If a user follows 1,000 accounts, computing this dynamically on every page refresh requires querying 1,000 separate user timelines, merging and deduplicating millions of records in memory, and sorting them chronologically.

Executing this query dynamically for hundreds of millions of active users would instantly crash relational database clusters.

Twitter Timeline Generation & Hybrid Fan-Out Architecture 🐦

PRO Architecture Blueprint

Twitter Timeline Generation & Hybrid Fan-Out Architecture 🐦

Bifurcated Fan-Out on Write (Push) for regular users and Fan-Out on Read (Pull) for high-degree celebrity accounts.

Twitter Timeline Generation & Hybrid Fan-Out Architecture 🐦
100%
Rendering visual architecture flowchart...
PRO & LIFETIME CURRICULUM

Unlock Topic #263: Twitter / X: Real-Time Timeline Generation & Fan-Out Architectures

You are viewing a preview. The full in-depth engineering deep dive, interactive simulators, architecture flowcharts, and self-assessment quizzes for this topic are available with Pro or Lifetime Access.

Production Deep Dive

Failure modes, high-throughput bottlenecks, and real FAANG implementation decisions.

Interactive Blueprints

Interactive system topology diagrams, live parameter simulators, and downloadable SVG charts.

Knowledge Assessment

Staff-level multiple-choice quiz questions with instant feedback and answer explanations.

Cross-Device Progress Sync

Firebase Google authentication automatically syncs your completed topics and quiz scores.

Rate This Architecture Chapter4.9 / 5.0 (38 ratings)

How clear and staff-actionable was this system breakdown?