Practice: Design Image Hosting
Image hosting service inspired by Imgur and Cloudinary: uploads go to object storage with a small metadata row, a CDN serves viewers from the edge, and thumbnails are made in the background.
Build this system yourself on the canvas below. Add components, connect them, and run traffic simulations to see where your design holds up and where it breaks.
Functional requirements
- Upload an image (up to 10 MB) and get back a shareable link; the file is stored in object storage and a small metadata row is saved
- View an image by its link, served from the CDN so popular images load quickly everywhere
- Generate smaller thumbnails of every upload in the background
- Keep every uploaded image until its owner deletes it, and remove it from storage and the CDN when they do
- Reject files that are not images, and files that are too large
- Limit uploads per user or IP so one client cannot fill the storage
Non-functional requirements
- View latency < 100ms p99 for popular images via the CDN and hot image cache
- Upload accepted < 500ms p99 for the request, with the file going straight to storage
- Thumbnails are ready within 30 seconds of upload
- Handle 10K image views per second at peak and 200 uploads per second
- 99.999% durability: an uploaded image is never lost (replicated object storage)
- Scale to 100M images stored; storage cost grows linearly and cold images move to cheaper tiers
- 99.99% availability for viewing