Interview OS
Back to System Design

System Design

Recommendation engine

Senior level · full staged walkthrough

Senior

Architecture

Senior
UserCandidatesRankingServing~hundredsfeaturesclicksUserCandidate gencollab + contentRanking modelFeature storeServing APIFeedback loop
ClientServiceDataEdgeAsync

Solution, step by step

  1. 1

    Functional requirements

    • Personalized item recommendations
    • Handle cold-start users/items
    • Balance relevance with diversity
  2. 2

    Non-functional requirements

    • Serving latency < 200ms
    • Online + offline scoring
    • Refresh features in near real time
    • A/B testable
  3. 3

    Capacity & estimation

    • 100M users, 10M items → embeddings + feature store at scale
    • Candidate generation narrows millions → hundreds
    • Serving QPS: tens of K
    • Offline training on TBs of interaction logs
  4. 4

    Preliminary design

    • Candidate generation (collaborative + content)
    • Ranking model on user/item features
    • Online features via a feature store
  5. 5

    Final architecture

    • Multi-source candidate generators (collaborative filtering + content + popularity)
    • Ranking model scores candidates with user/item/context features
    • Feature store serves fresh online features at low latency
    • Serving API applies diversity/business rules; logs for training
    • Feedback loop retrains models; exploration for cold items

Interview Q&A (8)

Candidate generation narrows millions of items to hundreds (cheap recall), then a ranking model scores that small set with rich features (precision).

Key components

  • Candidate generators
  • Feature store
  • Ranking model
  • Serving API
  • Feedback loop

Bottlenecks & how to address them

  • Feature freshness → streaming feature updates
  • Ranking latency → cap candidate count
  • Cold-start → content-based fallback + exploration

Tradeoffs to articulate

  • Exploration vs exploitation
  • Batch vs real-time features
  • Diversity vs relevance

Where this content comes from

For full transparency, this content is curated and verified from these sources:

Published architecture case studiesCompany engineering blogsOppZen design rubric library