System Design
Product Reviews
Design a product ratings and reviews system like the one on Amazon or Yelp.
Functional requirements
- A signed-in customer can write one review per product: a 1 to 5 star rating, an optional title, and a body up to 5,000 characters.
- A customer can edit or delete their own review, and the product's rating summary reflects the change.
- A product page shows the rating summary: average stars to one decimal, total review count, and a five-bucket star histogram.
- Readers can mark a review helpful, and the product page shows the first page of 20 reviews sorted by helpfulness or by recency, with paging for the rest.
- Every submitted review passes a moderation check and stays invisible to other shoppers until it is approved.
Non-functional requirements
- p99 latency for the rating summary and the first page of reviews is under 150ms, since both render inside the product page.
- Availability beats freshness on reads: the average and histogram may lag a newly published review by up to 60 seconds, but the buckets must always sum to the displayed count and must never drift permanently from the stored reviews.
- The author of a review sees it immediately after submitting, marked as pending, while other shoppers see nothing until moderation approves it.
- An accepted review is durable: once the writer sees a confirmation it survives node loss and is never silently dropped, including while it waits for approval.
- Abuse is bounded: one review per customer per product and one helpful vote per customer per review, so a double-submitted form never counts a rating twice.
Scaling & constraints
- 200M products in the catalog and 500M stored reviews today, retained indefinitely and growing by 20M new reviews per month, which is about 8 new reviews per second on average.
- Read:write ratio is roughly 5,000:1 at peak (300,000 product page views per second against ~60 review writes per second) and about 6,000:1 on an average day; helpful votes are about 20x more common than reviews, peaking at ~1,200 per second.
- Peak of 300,000 product page views per second during sales events and ~50,000/sec on an average day, with the top 0.1% of products (200,000 items) drawing ~40% of those views.
- An average review record is ~1.5 KB (rating, title, body, author id, timestamps); a product's aggregate (count, rating sum, five bucket counters) is ~100 bytes.
- A newly launched product can go from zero to 10,000 reviews in 48 hours, and a few hundred bestsellers hold ~100,000 reviews each (~30M of the 500M total), while the median product has fewer than 5.
- The moderation classifier answers in ~300ms and auto-clears ~95% of submissions; the other 5%, about 1M reviews a month, wait in a human queue for up to 24 hours.
Out of scope
- Customer accounts, authentication, and verified-purchase checks.
- Photo and video attachments on reviews.
- Seller responses, comment threads on reviews, and reviewer profiles.
- Product search, product ranking, and personalized review ordering.
Sign in to save your progress
AI design evaluation
Get a score, what your board does well, what to fix first, and what an interviewer would ask next.
Sign in to get AI feedback on your design.