Skip to content

Resource · Guide or article

Design Amazon's sales rank by category feature

Works through a batch analytics prompt modeled on Amazon's sales rank: computing the past week's best-selling products in each category for a large store. It suits candidates who want practice with MapReduce-style pipelines feeding a read-heavy API.

Reviewed

Open the original: Design Amazon's sales rank by category feature (opens the original site in a new tab)

Practice this topicOpens the practice interviewer in System design mode; choose a question there.

Add to a roadmap

Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.

Source content: English

A worked system design exercise from “The System Design Primer”. Steps: Outline use cases and constraints; Create a high level design; Design core components; Scale the design.

PrepKit overview

PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.

Suited to
The source does not state a level
Format
Guide

What it covers

  • Assumes 10 million products, 1,000 categories and 1 billion transactions a month, with results updated hourly and a 100 to 1 read to write ratio.
  • Estimates about 40 bytes per transaction, 40 GB of new data a month, and 40,000 reads per second on average.
  • Shows a two-step MapReduce job in Python: sum quantity per category and product, then let the shuffle sort by category and count.
  • Defines a sales_rank SQL table and a REST endpoint that returns ranked products for one category.
  • Scaling notes that read replicas may not keep up with cache misses at this volume, which points to sharding, federation or NoSQL.

How to use it

PrepKit study advice, not a claim made by the source.

Trace the sample log rows through both MapReduce steps on paper and check your result against the sorted list on the page. Then explain how you would serve the ranking at the page's estimate of 40,000 reads per second.

Scope and limitations

One possible design based on the exercise's own assumptions. The rest of the store is out of scope, items cannot change category, and there are no subcategories. Examples name Amazon S3, Redshift and BigQuery. The MapReduce code is a sketch with typos, and its sort is ascending, so a top list needs the order reversed.

Access and format

README on GitHub in the donnemartin/system-design-primer repository by Donne Martin, licensed CC BY 4.0. English, free to read online.

Reviewed by PrepKit on Oct 2, 2026. Listing source commit: ae9bbd7b02d9

Evidence behind this overview
  • solutions/system_design/sales_rank/README.md

Pages that include this

Get the PrepKit newsletter

Optional. You don't need it to use PrepKit.

How we handle your email