Skip to main content

Preview — Pro guide

You are seeing a portion of this guide. Sign in and upgrade to unlock the full article, quizzes, and interview answers.

Design Twitter/X Feed (News Feed)

End-to-end design of a social media news feed serving 200 million daily active users. The central design challenge is the fan-out problem: how to show a user their personalized timeline of tweets from all the accounts they follow, with < 200ms latency, at 180K reads/sec.

40 min read 3 sections 1 interview questions
Fan-OutRedisCassandraKafkaCDNNews FeedSocial GraphTimeline

The Core Problem: Feed Generation

A Twitter-like feed must show User A the most recent tweets from all accounts User A follows, ranked by recency (and optionally by engagement). The challenge is scale: 500M total users, 200M daily active users, 50:1 read-to-write ratio (20B reads/day vs ~400M writes/day). The central trade-off is where to pay the computational cost: at write time (pre-compute each follower's feed when a tweet is posted) or at read time (compute the feed on-the-fly when the user opens their app). Neither extreme works at full scale — the answer is a hybrid.

Scale Assumptions

MetricValue
Total users500M
Daily active users (DAU)200M
Average follows per user200
Tweet writes/day~400M (~5K/sec avg, ~15K/sec peak)
Timeline reads/day~20B (~230K/sec avg, ~700K/sec peak)
Read-to-write ratio50:1
Tweet size (text + metadata)~1KB
Media (images/video)Served separately via CDN
10-year storage (tweets only)~19 PB
IMPORTANT

Premium content locked

This guide is premium content. Upgrade to Pro to unlock the full guide, quizzes, and interview Q&A.