Medium👤 3-5 years👤 8-15 years 1 min read

How would you design a social news feed (timeline)?

Asked inAmazonGoogleMicrosoft
#news feed#fanout#timeline#celebrity problem#caching
Report issue

⚡ 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

Fan-out-on-writepush to follower feeds — fast read
Fan-out-on-readassemble at read — cheap write
Celebritymillions of followers breaks push
Hybridpush normal, pull celebrities

🔥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:

fan-out write vs readwrite amplificationcelebrity problemhybrid approachfeed caching

⚠️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

RedisKafkafan-outfeed ranking

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.
Open inChatGPTGeminiClaude

Was this answer helpful?

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.

Related Questions