Design an Image Upload System
Problem Design a service that lets clients upload, retrieve and delete images, with well-defined REST APIs, correct HTTP semantics, and efficient retrieval at scale.
Functional requirements
- Upload an image (single and, for large files, resumable/multipart).
- Retrieve an image by id; list images for a user or album with pagination.
- Delete an image; enforce ownership.
- Serve derived sizes (thumbnail, medium, original).
- Store and query metadata: owner, dimensions, content type, upload time.
Non-functional requirements
- ~5M uploads/day (~60/sec average, ~300/sec peak), average object 2 MB -> ~10 TB ingested/day.
- Read:write ~50:1 -> ~3k image GETs/sec at peak, mostly served from CDN with a >90% hit rate.
- Upload p95 < 2 s for a 2 MB file; cached read p95 < 100 ms.
- 11-nines object durability; metadata store 99.99% available.
- Max object size 25 MB; reject anything larger at the edge.
Areas to go deep
- The upload path: proxying bytes through the API vs pre-signed URLs direct to the object store.
- Where the bytes live (object store vs DB) and how metadata points at them.
- Listing/pagination at scale, thumbnail generation strategy, and idempotency of retried uploads.
asked …