Design the product catalogue for an online store with 2 million products. Shoppers view product pages with a title, description, price, stock status and several images. Pages are read about 15,000 times per second at peak, while merchants edit around 50 products per second. When a price changes, shoppers should see the new price within a minute. During sales events traffic doubles and almost all of it lands on a few thousand products.
Functional requirements
View a product page with details, price and images
List products in a category with paging
Merchants create and edit products and upload images
Price and stock changes appear on product pages within 60 seconds
Non-functional requirements
Product pages load in under 250 ms at p95
The catalogue stays readable if the database is briefly unavailable
Images load quickly worldwide
Constraints and scale
2 million products, 5 images each
15,000 page reads per second at peak, 50 edits per second
Sales events double traffic, concentrated on popular products
You will practise
Apply the cache-aside pattern to a read-heavy workload
Invalidate or expire cached entries when data changes
Offload static media to object storage and a CDN
Show 2 hints
With 300 reads for every write, where should most reads be answered?
When a merchant edits a price, which cache entries become wrong?