Design a news feed
One question decides this design — does the poster pay to deliver, or does the reader pay to assemble? This works the cost model in numbers, shows why every real feed is a hybrid, implements the k-way merge the read path needs, and handles the celebrity problem, ranking, and pagination that does not skip posts.
What you'll be able to do
- Derive the write amplification of fan-out on write and the read cost of fan-out on read from follower counts
- Justify a hybrid design with an explicit threshold, and say what happens to a user who crosses it
- Implement a k-way merge over per-author timelines and bound its cost
- Handle ranking, pagination that does not skip or duplicate, and the failure modes of a fan-out worker
Before this: queues-and-backpressure, caching-and-stampedes
The rest of this lesson is in the app
One question decides this design — does the poster pay to deliver, or does the reader pay to assemble? This works the cost model in numbers, shows why every real feed is a hybrid, implements the k-way merge the read path needs, and handles the celebrity problem, ranking, and pagination that does not skip posts. This walkthrough runs about 28 minutes, with runnable code you can edit and re-run as you read.
Continue in ChannelPulseThe first module of every track is free to read on the web — see what's open in System design.