System Design: Personalized Recommendations for a Consumer App
Context
Assume you are building the home-feed recommendations for a large consumer app (choose one: video streaming, news, or e-commerce). For concreteness, you may anchor your design on a video streaming app with both subscription and ad-supported content. You must propose a production-ready system that balances user experience with engineering constraints.
Requirements
Design an end-to-end personalized recommendation system and address the following:
-
Objectives and Constraints
-
Clarify business objectives (e.g., engagement, retention, revenue) and trade-offs (engagement vs. monetization).
-
Define latency SLAs (p95/p99) and freshness requirements for new content and user signals.
-
Architecture (end-to-end)
-
Data ingestion and logging, streaming vs. batch.
-
Feature store (offline and online parity).
-
Candidate generation (recall) strategies and services.
-
Ranking model(s) and serving.
-
Re-ranking for diversity, deduplication, and business rules.
-
Online inference path and caching.
-
Feedback loops for model updates and real-time features.
-
Modeling and Algorithms
-
Specify models for candidate generation (e.g., two-tower, collaborative filtering, content-based, graph/sequence models) and ranking (e.g., GBDT/DNN/MTL).
-
Handle cold-start for users/items and exploration (e.g., contextual bandits).
-
Real-time updates, deduplication, diversity, and content safety.
-
Evaluation and Experimentation
-
Offline metrics and validation.
-
Online metrics, guardrails, and an A/B testing plan (power, duration, ramping, and guardrails).
-
Scale and Reliability
-
Traffic assumptions, QPS estimates, storage sizing, and sharding.
-
Caching strategy, failure modes, and graceful degradation.
-
Monitoring/alerting (SLOs), privacy, and bias/fairness considerations.
Deliverable
Provide a structured proposal with diagrams-as-text or clear component breakdowns, explicit assumptions, and concrete numbers where helpful (e.g., latency budgets, QPS, storage). Include alternatives and trade-offs where relevant.