AdvancedSystem-Design
45 min
Design a Social News Feed
System DesignCachingML RankingDatabases
Advertisement
Interview Question
Design a personalized news feed for a social network with billions of events per day. Cover write fan-out vs read fan-out, ranking, and cold start.
Key Points to Cover
- Feed models: push (fan-out-on-write) vs pull (fan-out-on-read) and hybrids
- Storage: activity logs, user timelines, dedupe, TTL
- Ranking: features, freshness, graph signals, experimentation
- Caching: per-user feed cache; invalidation and precompute
- Systems: backfill, re-ranking, nearline vs offline pipelines
Evaluation Rubric
Chooses feed model with trade-offs25% weight
Designs efficient feed storage/caches25% weight
Outlines ranking and experimentation25% weight
Backfill, cold start, and reliability25% weight
Hints
- 💡Hot users and celebrities create write hotspots.
Common Pitfalls to Avoid
- ⚠️**Ignoring Super-users' Fan-out:** Failing to explicitly design for the write amplification caused by users with millions of followers can lead to severe performance bottlenecks and system instability.
- ⚠️**Over-reliance on a Single Fan-out Model:** Choosing only a push or only a pull model without understanding their respective scaling limitations for different user bases, rather than adopting a hybrid strategy.
- ⚠️**Lack of Freshness in Ranking:** An ML ranking model solely optimized for engagement might prioritize older, 'proven' content, leading to a stale user experience if freshness isn't explicitly factored in.
- ⚠️**Inefficient Data Storage for Timelines:** Storing full content objects directly in user inboxes instead of references, or neglecting to implement TTL, leading to massive storage costs, slower reads, and difficulty managing data at scale.
- ⚠️**Neglecting Cold Start Strategies:** Not having robust mechanisms to provide a meaningful and engaging feed for new users or inactive users, which can significantly hinder user onboarding, adoption, and long-term retention.
Potential Follow-up Questions
- ❓How do you prevent spam/duplicates?
- ❓What about “stories” style feeds?
Advertisement