Capacity Estimation for a Photo-Sharing App
You are asked to design a photo-sharing service. After clarifying requirements you have agreed these assumptions with the interviewer:
- 200 M monthly active users, 50% active on any given day
- Each active user uploads 0.5 photos/day and views 50 photos/day
- A stored photo (with two thumbnails) averages 600 KB; metadata is ~300 B
- Retention: 5 years
- Compute average and peak (assume 3× average) upload QPS and view QPS.
- Estimate storage growth per day and the total after 5 years, split into media and metadata.
- Using the 80/20 rule, size a cache for the day's popular photos, and say which number in your estimate points to the hardest part of the design.
1. Traffic
DAU = 200 M × 0.5 = 100 M.
Uploads/day = 100 M × 0.5 = 50 M → 50 × 10^6 / 86,400 ≈ 580 uploads/s average, ≈ 1,750/s peak.
Views/day = 100 M × 50 = 5 B → 5 × 10^9 / 86,400 ≈ 58,000 views/s average, ≈ 175,000/s peak.
Read:write ≈ 100:1 → read-heavy; the design will be dominated by serving images, not by ingesting them.
2. Storage
Media: 50 M × 600 KB = 30 TB/day → × 365 × 5 ≈ 55 PB over 5 years.
Metadata: 50 M × 300 B = 15 GB/day → × 365 × 5 ≈ 27 TB over 5 years.
Media is ~2,000× the metadata volume. Metadata fits a sharded relational or wide-column store; media must live in object storage behind a CDN. Say this conclusion out loud — it is why the estimate was worth doing.
3. Cache and the hard part
80/20 rule: 20% of the day's uploads serve most of the day's views. 20% × 30 TB = 6 TB of hot media — too large for a RAM cache tier by itself, so hot images are served from CDN edge caches and the RAM cache holds metadata: 20% × 15 GB = 3 GB, which is trivial.
The scary number is 175k views/s peak of image bytes: 175k × 600 KB ≈ 100 GB/s of egress if every view fetched a full-size photo. That is the hard part — it drives the CDN design, serving appropriately sized thumbnails rather than originals, and cache hit ratio at the edge. Ingest at 580–1,750/s is comparatively easy: an upload service writing to object storage plus an asynchronous thumbnail pipeline behind a queue.
Share this question