Reliable systems · 4 / 4
Design a personalised feed
Your challenge
Design a feed for users following creators. Compare fan-out on write and fan-out on read, including a creator with millions of followers.
Try it first. Write down your assumptions and explain your reasoning.
1.Define ordering and freshness
Clarify whether the feed is chronological or ranked, how soon a new post must appear and what happens after a delete or privacy change. Use stable cursor pagination. List assumptions for followers, posts and reads; estimate the write amplification instead of choosing an architecture from a memorized diagram.
2.Compare the two fan-out strategies
Fan-out on write builds recipient feed references when a post is created, making reads cheap but writes expensive for popular creators. Fan-out on read gathers followed creators at request time, reducing write amplification but increasing read cost. A hybrid can precompute ordinary creators and merge popular creators on read.
3.Handle correctness at read time
Feed entries should reference posts rather than copying the entire payload forever. Re-check authorization and deletion state before returning content. Dedupe merged references, cache with bounded freshness and use queues for background fan-out. Monitor backlog: delayed workers should degrade freshness gracefully, not silently lose posts.
Take it one step further
- 1.What happens when a user unfollows someone?
- 2.How do you handle a post becoming private after fan-out?
Self-review
Can you explain each point without looking at the solution?
- Requirements before fan-out choice
- Explain write amplification and hot creators
- Read-time authorization, deletion and deduplication
