How would you design a movie recommendation system for a small app with 10,000 users and 2,000 movies? Using a 3×3 rating table where Movie A has ratings (3,4,0), Movie B has (4,3,0) and Movie C has (0,3,4) from three users, what is the cosine similarity between Movie A and Movie B, and how much storage is needed to precompute 20 recommendations per user nightly?

ML system design, Case studies
Level L2 Elementary. Length Medium. Nature Th+Mat Both.

What's being asked

Whether you can design a small-scale recommender end to end, compute an item–item cosine similarity by hand, and size a simple batch storage table.

Key idea

At 10,000 users and 2,000 movies, you do not need a complex real-time neural pipeline. Start with a popularity baseline, upgrade to item–item collaborative filtering using cosine similarity, precompute the top 20 picks per user each night in a tiny table, and test changes with an A/B experiment.

Steps

  1. Clarify scale, objective and metrics: with 10,000 users and 2,000 movies (20 million mostly empty cells), nightly batch updates on one machine are plenty. Help users discover and finish movies by tracking recall@20 or NDCG@20 (normalised discounted cumulative gain at 20) offline on held-out watches, and recommendation CTR (click-through rate) plus watch-completion rate online.
  2. Specify data, labels and item–item cosine similarity: combine sparse explicit 1–5 ratings with dense implicit clicks and watch duration. Compare movies via cosine similarity cos⁡(u,v)=u⋅v∥u∥∥v∥. For Movie A =(3,4,0) and Movie B =(4,3,0): ∥A∥=32+42+02=5,∥B∥=42+32+02=5, A⋅B=3(4)+4(3)+0(0)=24,cos⁡(A,B)=245×5=2425=0.96. (By contrast, Movie C =(0,3,4) has cos⁡(A,C)=12/25=0.48, so a user who liked A gets B ranked above C.)
  3. Build the model (start simple, then improve): start with a popularity baseline (most-watched movies this week, or top by genre). Next, compute the 2,000×2,000 item–item similarity matrix and score unrated movies for each user by weighted similarity to movies they liked; later, add matrix factorisation or genre/metadata features.
  4. Serving architecture and storage calculation: run a nightly batch job that computes the top 20 recommendations per user and writes them to a fast lookup table (such as Redis or Postgres). Storing 8 bytes per entry (4-byte movie ID plus 4-byte score) requires: 10,000×20=200,000 entries,200,000×8 bytes=1,600,000 bytes=1.6 MB (megabytes), so the entire table fits effortlessly in memory with sub-millisecond reads.
  5. Evaluation, cold start and interviewer trade-offs: handle cold-start users (new users with no history) with the popularity or onboarding-genre baseline, and validate the new recommender against popularity in an online A/B test. An interviewer will probe cold-start movies (solved by genre/cast metadata), filter bubbles (solved by mixing in some popular or diverse picks) and batch staleness versus live updates.
  6. Monitor and iterate: track daily batch job success, cache coverage, click-through rate and diversity of shown movies, and refresh similarities nightly as new watches arrive. The large-scale video recommendation case study builds on this by adding two-stage retrieval and ranking for millions of items and real-time session features.

Common mistakes

How long your answer should be

About 4–5 minutes; walk through the design stages, cosine calculation and storage estimate.

Read this

Previous in ML system design: How would you design a spam filter for a small college email server that receives 5,000 emails a day, of which about 20% are spam? If your model achieves 95% recall and a 0.5% false-positive rate, how many spam emails are missed and how many legitimate emails are wrongly flagged per day?
Next in ML system design: What are data, tensor and pipeline parallelism in distributed training, and when should you use each?