How would you design a social news feed (timeline)?
⚡ Short Answer
Two models: fan-out-on-write (push each post into followers' precomputed feeds — fast reads, expensive for users with many followers) and fan-out-on-read (assemble the feed from followees at read time — cheap writes, slower reads). Real systems use a hybrid: push for normal users, pull for celebrities.
☕Coffee Chat Question
Concept Made Simple
“How would you design a social news feed (timeline)?”
🧠Mind Map Answer
Remember It Faster
🔥What If?
Think Beyond the Expected
A celebrity with 50M followers posts — why does pure fan-out-on-write fall over?
One post triggers 50M feed writes — a massive, slow write amplification that can lag or overwhelm the system. The hybrid fix: don't fan-out celebrity posts on write; instead pull their recent posts at read time and merge into each follower's feed. Push for the long tail, pull for the few huge accounts.
😂Real World
Twitter/Instagram-style feeds use hybrid fan-out with heavy caching of precomputed timelines; the 'celebrity/hot-key' problem is the classic reason pure push doesn't scale.
🎯Interviewer's Expectation
Keywords they're listening for:
⚠️Common Mistakes
- ✗Pure fan-out-on-write ignoring celebrities
- ✗Pure fan-out-on-read (slow feeds at scale)
- ✗No caching of precomputed timelines
✅Best Practices
- ✓Hybrid push/pull by follower count
- ✓Cache precomputed feeds
- ✓Handle hot keys explicitly
🔁Follow-up Questions
- 1How do you rank/order the feed?
- 2Where does caching fit in the feed?
- 3How do you handle the hot-key/celebrity case?
🧩Related Technologies
Continue Learning with AI
Take this question deeper with your favourite AI assistant. Pick a depth, copy the prompt, or open it directly — AI is your learning companion, not a shortcut.
Plain-language foundations
I'm preparing for a software engineering interview and want to understand this from scratch, as a beginner. Topic: Scaling (System Design) Interview question: "How would you design a social news feed (timeline)?" Please: 1. Explain the core idea in simple, plain language, using an everyday analogy. 2. Define any technical terms you use. 3. Walk through one small, concrete example. 4. Finish with a single sentence I can easily remember. Keep the tone friendly and assume I'm new to this topic.
Was this answer helpful?
⭐ Featured Products
Support our platform by exploring our recommended products.
As an Amazon affiliate, purchases through these links may earn us a small commission — at no extra cost to you. It helps keep Full Stack Interview Guru free.