#06EasyHigh-Concurrency Feeds & Social

Design Twitter for millions of users

ASKED IN INTERVIEWS AT:UberCoupangMeta

EXECUTIVE SUMMARY & PROBLEM STATEMENT

Architect a microblogging timeline engine handling sudden traffic spikes from breaking news, asynchronous tweet fan-outs, and rapid reverse-chronological timeline rendering.

SCALE ESTIMATION & TRAFFIC ENVELOPE

DAILY ACTIVE USERS / TPS300 Million DAU, 500M tweets/day, 600K timeline reads/sec
READ / WRITE TRAFFIC RATIO100:1 read-to-write
5-YEAR STORAGE CAPACITY~300GB of tweet text daily + media storage in CDN

FUNCTIONAL REQUIREMENTS

  • [1]Post tweets (text, images)
  • [2]Follow users
  • [3]View Home Timeline and User Timeline
  • [4]Retweet and like

NON-FUNCTIONAL REQUIREMENTS

  • •Read latency < 50ms for Home Timeline
  • •Highly available read path
  • •Eventual consistency for follower counts

CORE ARCHITECTURAL COMPONENTS

Timeline Service
Fan-out Service
Redis Redis-Cluster Home Timelines (800 most recent tweets)
Search Cluster (Elasticsearch/Lucene)

DATA SCHEMA & PERSISTENCE

Tweet (tweet_id, user_id, content, created_at), Follows (follower_id, followee_id)

DISTRIBUTED TRADE-OFFS & FAILURE MODES

  • ⟡Pre-computing timelines into Redis lists ensures instantaneous read latency at the expense of high write amplification.