Full answer
Why estimate
Numbers decide the design. 50 writes per second fits one database comfortably; 50,000 writes per second means sharding or a log-structured store. 2 GB of data fits in memory; 200 TB does not. The interviewer wants to see that you can get the order of magnitude right and draw conclusions from it.
Useful constants
- 1 day = 86,400 seconds, about 10^5 for quick maths.
- 1 million requests per day is about 12 per second.
- 1 KB = 10^3 bytes, 1 MB = 10^6, 1 GB = 10^9, 1 TB = 10^12, 1 PB = 10^15 (decimal units are fine for estimates).
- Rough latency orders of magnitude, commonly quoted and hardware dependent: memory access around 100 ns, SSD random read around 100 microseconds, round trip inside a data centre around 0.5 ms, round trip between continents around 100 to 200 ms.
The steps
- Users: daily active users (DAU).
- Actions: how many reads and writes per user per day.
- Rates: total per day / 86,400 = average per second. Multiply by a peak factor (2 to 5 is common; state yours).
- Storage: writes per day x size per item x days retained x replication factor.
- Bandwidth: requests per second x response size.
- Memory for cache: the hot fraction of data you want in RAM.
- Conclusion: what does this mean for the design?
Worked example: homework photo uploads
Assumptions: 10 million DAU; each user views 20 pages per day; 1 million photos uploaded per day; average photo 200 KB after compression; keep photos 1 year for now; peak factor 3.
- Page reads: 10M x 20 = 200M per day. 200M / 86,400 = about 2,315 per second average, about 7,000 per second at peak.
- Uploads: 1M / 86,400 = about 12 per second, about 35 per second at peak.
- New photo storage: 1M x 200 KB = 200 GB per day. Over 365 days: 73 TB. With 3 copies for durability: about 219 TB. (Object stores handle replication for you, but the bytes are still paid for.)
- Upload bandwidth at peak: 35 x 200 KB = 7 MB/s, small.
- If each page view shows 5 photo thumbnails of 20 KB: 7,000 x 5 x 20 KB = 700 MB/s at peak, which is why thumbnails go through a CDN.
Conclusions: writes are low and fit one database for metadata; storage is large and belongs in object storage; read bandwidth for images needs a CDN.
Habits that help
- Say each assumption out loud and write it down.
- Round to easy numbers (86,400 to 100,000) when the interviewer does not need precision, and say you are rounding.
- Keep units in every line.
- Sanity check: does the answer match something you know? A single modern database server handling a few thousand simple writes per second is plausible; a million is not.
By level
Fresher: Convert daily users and actions into requests per second and estimate storage for a year with simple, stated assumptions. Each number should be followed by what it means for the design.
Mid: Include peak factors, replication, bandwidth and cache sizing, and use the numbers to justify concrete choices such as sharding or a CDN. Expect units on every line and no mix-up of bits and bytes.
Senior: Estimate cost, headroom and growth, identify which resource saturates first, model failure scenarios (one region down means the others take the load), and challenge assumptions that drive the biggest numbers. The senior answer names the resource that will run out first.
Key points
- State assumptions before calculating
- Divide daily totals by 86,400 and apply a stated peak factor
- Storage = items per day x size x retention x replication
- Keep units on every line and round openly
- Turn every number into a design decision
Common mistakes
- Producing numbers without saying what they imply for the design
- Forgetting the peak factor or replication
- Mixing bits and bytes in bandwidth
- Spending ten minutes on precise arithmetic the interviewer did not need
Follow-ups
- How would the estimate change if videos replaced photos?
- How many cache servers would you need for the hot 20% of data?
- What peak factor would you use for an exam results day?
Tips
- Write assumptions on the board in a short list
- Use 1 million per day is about 12 per second as a shortcut
- End each estimate with "so we need..."
Evaluation rubric
- Clear, explicit assumptions
- Correct arithmetic with units
- Covers rate, storage and bandwidth
- Draws design conclusions from the numbers