Social Feeds & Realtime FanoutPRODUCTION RETROSPECTIVE

Twitter / X: High-Fanout Timelines, Snowflake IDs & Distributed Key-Value Stores

How Twitter/X routes half a billion daily tweets to 300M+ active users using hybrid push/pull fanout timelines, Snowflake 64-bit unique IDs, and Manhattan key-value clusters.

High-Level Architectural Overview

Twitter employs a hybrid timeline engine: regular users fan out writes into followers Redis timeline caches (push model), while celebrity accounts with millions of followers are merged dynamically on read (pull model) to prevent catastrophic fanout bottlenecks.

Key Engineering Problems & Trade-Offs

Hybrid Push vs Pull Fanout Topology

500M+ daily tweets and peak 150,000 tweets per second during world events
The Scaling Problem

Celebrity accounts with 50M+ followers cause millions of Redis list writes per second if purely push-based, resulting in massive queue latency.

Engineering Solution

Push writes for accounts with < 20,000 followers directly into follower timeline Redis lists. For accounts > 20,000 followers, store tweets in a user timeline and dynamically merge at read time.

Architectural Trade-Offs

Read latency slightly increases during feed fetch due to runtime merges, but eliminates write spikes and background worker queue starvation.

How to Say This in an Interview

Always propose hybrid fanout in feed design rounds: write-fanout for normal users, read-merge for high-fanout power users.

Curriculum Topics Used in Twitter / X Architecture (226)
Full Syllabus
Phase 1#3

Request/Response Lifecycle (Browser → Server → DB)

Trace the complete end-to-end journey of a single network packet from user click to database row mutation and DOM re-render.

8 min readRead Blueprint →
Phase 1#4

IP Addressing (IPv4/IPv6, Public vs Private)

Explore numerical addressing schemes, subnetting (CIDR), NAT (Network Address Translation), and why private VPCs shield internal architectures.

7 min readRead Blueprint →
Phase 1#6

HTTP/HTTPS Fundamentals

Understand the application protocol powering the World Wide Web, including plaintext HTTP vulnerabilities, TLS encapsulation, and status semantics.

6 min readRead Blueprint →
Phase 1#7

HTTP Methods, Status Codes, & Headers

Master the RESTful grammar of the web: Idempotency semantics, safe vs unsafe methods, status classes (2xx, 3xx, 4xx, 5xx), and caching/security headers.

7 min readRead Blueprint →
Phase 1#8

TCP vs UDP Tradeoffs

Compare reliable byte streams against lightweight datagrams: flow control, congestion avoidance, head-of-line blocking, and when to pick UDP for real-time scale.

8 min readRead Blueprint →
Phase 1#9

TCP Three-Way Handshake & Connection Lifecycle

Deep dive into SYN, SYN-ACK, ACK, sequence number synchronization, state machines (ESTABLISHED, TIME_WAIT), and connection termination (FIN/RST).

8 min readRead Blueprint →
Phase 1#10

TLS/SSL Handshake & Encryption Basics

Understand asymmetric vs symmetric cryptography, Diffie-Hellman Ephemeral key exchange, X.509 Certificate Authorities, and TLS 1.2 vs TLS 1.3 1-RTT/0-RTT speedups.

9 min readRead Blueprint →
Phase 1#11

OSI vs TCP/IP Model Overview

Understand abstraction layers in distributed networking: Layer 4 (Transport/TCP) vs Layer 7 (Application/HTTP), encapsulation, and debugging network boundaries.

7 min readRead Blueprint →
Phase 1#12

Sockets & Ports (Network Programming Basics)

Explore kernel network primitives: File descriptors, socket bindings, ephemeral port allocations, non-blocking I/O, and the C10K/C1000K concurrent connection problem.

8 min readRead Blueprint →
Primary Technical Sources & Published Papers
Timelines at Scale

Raffi Krikorian, Twitter Engineering • 2022

Ready to Practice Twitter / X-Style Systems?

Start with foundational networking, compute, and storage, and build up to complex distributed consensus.

Start Free: Topic #1