KatInterview

Design the Infrastructure Behind a Recommendation Feed

System DesignModel answer
HardModel answerSystem Designrecommendation-systemsdistributed-systemscaching

Last updated

Design the serving and storage layers for a recommendation service, covering API shape, data flow, storage schemas, caching, and how batch training coexists with live traffic.

The Problem

A product team wants to launch a personalized recommendation feed — think a home feed, a "you might also like" rail, or a weekly digest email. Your job is to design the backend infrastructure that powers it.

You are not designing the ML model itself. You are designing everything around it: how clients fetch recommendations, how user interactions are collected and stored, how the model reads training data, and how the serving layer stays fast and available under load.

A strong answer will:

  • State your scale assumptions before drawing any boxes
  • Sketch the API contract for both fetching recommendations and logging events
  • Describe the high-level architecture, including the read and write paths separately
  • Define the storage schemas for users, items, and interaction events — including indexing and partitioning choices
  • Explain how a daily batch training job and a low-latency serving layer can share the same data without interfering with each other
  • Discuss how you would handle scaling, fault tolerance, and freshness requirements

There is no single correct architecture. Interviewers want to see that you can reason through trade-offs, not that you have memorized a diagram.

Hints

Hint 1

Start by separating the read path (serving recommendations) from the write path (ingesting interaction events). They have very different scale characteristics and should be designed independently before you connect them.

Hint 2

Think carefully about how the interaction log is stored in multiple forms for different purposes: a message bus for transport, an object store for training, and a row store for online feature lookups. Each has different access patterns and consistency requirements.

Hint 3

Train/serve skew is one of the most common failure modes in real recommendation systems. Think about how you would log the exact features used at serve time so you can reproduce training labels accurately.