Design the service behind image uploads for a marketplace. Sellers upload photos; the system stores the original and produces three thumbnail sizes. Listing pages show thumbnails to millions of shoppers. Resizing is CPU-heavy and sometimes fails on corrupt files.
Functional requirements
Upload an original image
Generate three thumbnail sizes
Serve thumbnails on listing pages
Report failed images to the seller
Non-functional requirements
Uploads return in under 500 ms (resizing happens later)
No uploaded original is ever lost
A burst of uploads must not slow down browsing
Constraints and scale
2 million uploads per day, bursts of 500 per second
Shoppers view 30 000 thumbnails per second
Originals average 4 MB
You will practise
Move slow work off the request path with a queue
Store blobs in object storage behind a CDN
Handle poison messages with a dead-letter queue
Show 2 hints
Does the seller need to wait while thumbnails are generated?
What happens to a corrupt image that crashes the resizer every time?