System Design Lab
A social news feed lives or dies on the fan-out choice: push posts into every follower at write time, or pull and merge at read time.
Change daily active users, posting rate, average and celebrity follower counts, feed reads, feed size, and ranking cost. The design moves from pull-on-read merges to push fan-out with a feed cache, a hybrid that special-cases celebrities, a ranking pipeline, and finally sharded stores across regions.
Guided walkthrough
Reason about it one step at a time
Takeaway
Normal evolution scenarios
Click left to right for the intended demo path. Each card changes the workload inputs.
Recommended shape
Bottlenecks
Why this changes
Decision tradeoffs
Source-backed rules
These are the durable system-design claims behind the model. The exact slider thresholds are deliberately labeled as teaching assumptions.
Feeds are usually fan-out-on-write, with a hybrid for celebrities
The canonical write-up precomputes feeds by pushing posts to followers at write time, then special-cases very high-follower accounts by merging their posts at read time.
System Design PrimerRedis backs per-user feed caches as sorted lists
In-memory sorted structures hold each user feed so a feed read is a single fast range fetch instead of a database join.
Redis DocsKafka decouples post writes from heavy fan-out work
A durable log lets the post write return immediately while fan-out workers consume events and push into follower feeds asynchronously.
Apache KafkaDynamoDB-style partitioning scales the post and graph stores
Partitioning posts and follow edges by key spreads storage and write throughput across nodes as the dataset outgrows one machine.
AWS DynamoDBTeaching assumptions
- Write fan-out is modeled as posts/s times average followers; read fan-out as feed reads/s times followees merged.
- Single-node fan-out, cache, and store budgets are conservative teaching numbers, not vendor limits.
- Celebrity hybrid removes the largest accounts from write fan-out and adds a small per-read merge instead.