News Feed System Design Walkthrough
Complete design walkthrough with animated diagrams, capacity math, API design, schema, and failure modes.
Solution PathTarget: 30 min
We designed a news feed for 200M DAU with hybrid fanout: push for 99% of users under 10K followers, pull for celebrities. 1.28 TB Redis timeline cache across 120 nodes, Kafka-driven async fanout handling 1.16M writes/sec, and Snowflake IDs for globally ordered tweets. The hybrid threshold reduces max write amplification from 50M to 10K per tweet.
1/10
1.
What is News Feed?
We are designing the timeline you see when you open Twitter, Instagram, or Facebook: a personalized, reverse-chronological stream of posts loading in under a second. Twitter (now X) processes 500 million tweets per day across 200 million DAU, each following ~200 accounts. The real challenge is delivering every tweet to every follower's timeline in under 5 seconds, when a single celebrity tweet must reach 50 million people and a regular user's tweet must reach 200, all through the same system.
Building a list of tweets is not the hard part. The hard part is building that list for 200 million users simultaneously, where each list draws from a different set of 200 sources and new items arrive at 5,800 per second.
How we pre-compute versus build on demand, and how we handle the gap between 50 followers and 50 million followers, determines the entire architecture.
500M tweets/day across 200M DAU, each delivered in under 5 seconds. The real challenge: same system must handle 200 followers and 50M followers, which forces a hybrid fanout architecture.
Twitter delivers 500M tweets per day to 200M daily active users. When you tweet, how does it appear in your followers' timelines within seconds? We answer this with a combination of fanout strategies, pre-computed timeline caches, and a hybrid push-pull model that handles both normal users and celebrities with 30M+ followers. The system sounds simple, but the real challenge is managing write amplification: one tweet from a celebrity can trigger 30 million cache writes, and our design must handle that without delaying every other user's feed. Twitter (public engineering blog, 2012): hybrid fanout serves 300M+ timeline reads per day at sub-200ms latency.
- The core trade-off is fanout-on-write vs fanout-on-read. Push makes reads instant ( cache lookup) but triggers N cache writes per tweet. Pull makes writes instant but forces the reader to query N followees. We chose push for normal users and pull for celebrities above a 10K follower threshold.
- We chose Snowflake IDs (not AUTO_INCREMENT or UUIDs): a 64-bit integer with 41 bits for timestamp, 10 for machine, 12 for sequence. This gives chronological sorting for free (ORDER BY id = ORDER BY time) and generates unique IDs/sec with zero coordination.
- The timeline is a Redis sorted set holding 800 tweet IDs per user. At 8 bytes per ID, that is 6.4 KB per user, 1.28 TB for 200M users. Read latency: one ZREVRANGE call at sub-10ms.
- This topic tests your ability to reason about write amplification, hybrid fanout, and cache-first architectures. The patterns transfer directly to notification systems, activity feeds, and content recommendation pipelines.