Design Amazon Product Recommendations
On this page
Problem Description
In this interview, we're going to design the personalized recommendations on an online store's home page, similar to Amazon's or Walmart's. Shoppers browse products, search, add things to their cart and buy. When a shopper opens the home page, the system picks about 20 products from a catalog of hundreds of millions that they're most likely to buy, based on what they viewed, searched for and bought before, including what they did a moment ago in this visit. Products that are out of stock or can't be delivered to the shopper never appear, and neither do products like one they just bought, such as another TV. Shoppers click, add to their cart and buy, and the system keeps learning from what they do. You can use existing building blocks: a catalog service that knows every product's category, price, stock and where it can be delivered, and an order service that records every purchase. This interview is about choosing and ordering products, not about search or checkout.
Not the same as Design Similar Item Recommendations, which picks products like the one a shopper is looking at, without their personal history.
Out of Scope
- "Similar items" and "Frequently bought together" on product pages – they start from one product, not from the shopper; their own problem.
- Search ranking – another product with its own ranking.
- Sponsored products and ads – placed by the ads system.
- Recommendation emails and push messages – a good follow-up question: the same model, but sent at the right time.
- Prices, deals and stock – the catalog service owns them; we only read them.
Good Clarifying Questions
- How many shoppers and products? – About 300 million daily shoppers who open the home page about 3 times a day, and about 300 million products. Big sale days bring about three times the usual peak.
- What does "likely to buy" mean for the business? – Purchases from the home page. Clicks alone don't count, and purchases that get returned are a bad sign.
- How fast must the home page load? – Within 200 ms at p99, of which about 100 ms can go to the models.
- How fresh must it be? – What the shopper views or adds to their cart in this visit should shape the home page within a few seconds. A purchase should change it at once. Stock is checked live. The model should be retrained at least daily.
- What if recommendations fail? – The home page must still show products, such as bestsellers; an empty space or an error is not acceptable.
Requirements
Functional Requirements
- Show Recommendations on the Home Page – When a shopper opens the home page, it shows about 20 products they're most likely to buy, based on what they viewed, searched for and bought, including in this visit.
- Leave Out What Shouldn't Be Shown – The home page never shows products that are out of stock, can't be delivered to the shopper, or are like one they just bought.
- Record What Shoppers Do – The system records which products each shopper was shown and where, and what they did: click, add to cart, buy, return.
- Keep Learning – The system trains a new model from these records at least daily and gives it to shoppers only after it proves at least as good as the current one.
Non-Functional Requirements
- Scale – 300M daily shoppers × 3 visits = 900M home pages a day: about 10K/s on average, 30K/s at peak, up to 100K/s on big sale days, choosing from about 300M products.
- Latency – Home page under 200 ms at p99, with about 100 ms for the models.
- Freshness – Views and cart adds in this visit shape the home page within 5 seconds; a purchase changes it at once; a new model at least daily.
- Availability – 99.9%. If the models or the feature store are down, the home page shows bestsellers that are in stock; never an error.
Try it yourself first
You have the full problem. Sketch your answer, then sign up free to read the complete walkthrough.
- The complete design, flow by flow, with pictures
- Deep dives into the hard parts
- What mid, senior and staff candidates are expected to say
- Full company question lists
Free forever. No card needed.