Q29: How would you design a news feed?

Difficulty:AdvancedTopic:Design Problems

A feed can use fan-out-on-write, where a post is pushed into followers' feed stores, or fan-out-on-read, where posts are fetched from followed accounts when the feed is opened. Write fan-out makes reads fast but struggles with celebrities who have huge follower counts; read fan-out reduces write amplification but increases read cost. A hybrid approach pushes ordinary accounts and merges high-follower accounts at read time. Rank results separately and cache carefully.

Key Takeaways
  • Choose fan-out strategy based on follower distribution and read/write ratio.
  • Hybrid designs handle celebrity hotspots better.