Design an image hosting service (like Imgur)
medium 50 minUpload a picture, get a link at once, and let the whole world look at it.
Agree on the scope
Ask what changes the design, then commit to a short list.
Clarifying requirements
Interviewer
Design an image hosting service like Imgur. What do you want to know?
You
Three groups:
- Scale: users, uploads and views a day, countries, share of anonymous uploads?
- Features: images only or GIF and video; albums; comments and votes; a front page?
- Technical: largest file, which sizes, how fast, how available?
Interviewer
300M users a month, worldwide, 70% of uploads anonymous. 10M uploads and 5B views a day. Images and GIFs up to 20 MB. Albums matter, social features are secondary.
You
Then: upload, short link, sizes, view, albums, delete, with or without an account. Votes, comments, favourites and trending are thin additions. Video, editing in real time, adverts and detailed analytics are out.
Must have
- Upload JPEG, PNG, GIF, WebP up to 20 MB
- Unique short link at once
- Several sizes
- Albums with an order
- Delete by account or token
- Anonymous uploads
Later or out
- Votes, comments, favourites, trending
- Crop, rotate, filters
- Video hosting
- Real-time collaboration
- Adverts, detailed analytics
Quality targets
| Quality | Target | What it forces |
|---|---|---|
| View latency | under 100 ms at p99 from the edge | Copies near viewers |
| Link after upload | under 2 s after the last byte | Work in the background |
| Ready | 95% processed within 15 s | Workers sized for peak |
| Availability | 99.99% for views, about 53 min a year | Serve from caches when origin is down |
| Upload success | 99.9% with retries | Resumable, idempotent |
| Durability | no confirmed picture lost | Replicated object storage |
| Privacy | no location data published | Re-encode before public |
| Takedown | origin at once, edges within 5 minutes | Purge by tag, short browser life |
Why these questions
Each answer changes the design
| You ask | If the answer is | Then |
|---|---|---|
| Can an image be edited in place? | Yes | Version in the address, or short caching |
| Are some images private? | Yes | Signed addresses, no shared cache |
| Must links last for ever? | Yes | Storage grows without end; plan classes |
| Is the original needed? | Yes, by its owner | Keep it private, download by account only |
| Where are viewers? | One country | One region and a smaller CDN |