AI Hints
Home›System Design Tutorial›Measuring Speed
System Design · Lesson 6 of 120

Back-of-the-Envelope Math

Quick estimates.

⏱ 2 min read▶ Video at 5:48🎓 Free
Watch this lesson in the System Design courseWatch on YouTube ↗Full System Design course

Before designing anything, engineers make quick, rough estimates. How many requests per second? How much storage per year? You don't need exact answers, just the right order of magnitude.

Back-of-the-Envelope Math
From the video: Back-of-the-Envelope Math
  • Quick, rough estimates
  • Requests per second
  • Storage per year

Handy shortcuts

A few shortcuts make this easy. A day has about a hundred thousand seconds, eighty six thousand four hundred to be exact. A million requests a day is only about twelve per second. And peak traffic is often two or three times the average.

keyvalue
1 day≈ 100,000 seconds
1 million / day≈ 12 per second
Peak2–3 × average
1 KB × 1 million= 1 GB

Estimating a photo app

Let's estimate a small photo app. Ten million daily users, each uploads two photos a day, and each photo is five hundred kilobytes. Run it. That's about two hundred and thirty uploads per second on average, and double that at peak. Storage grows by ten terabytes a day, which is about eighteen petabytes over five years. Now we know storage is the big challenge.

estimate.pypython
users = 10_000_000
photos_per_user = 2
photo_kb = 500

per_day = users * photos_per_user
per_sec = per_day / 86_400
print(f"uploads/sec: {per_sec:.0f} (peak ~{per_sec * 2:.0f})")

tb_per_day = per_day * photo_kb / 1_000_000_000
print(f"storage/day: {tb_per_day:.0f} TB")
print(f"5 years:     {tb_per_day * 365 * 5 / 1000:.1f} PB")
Output
uploads/sec: 231 (peak ~463)
storage/day: 10 TB
5 years:     18.2 PB

Summary

Rough math tells you where the hard part of a design is. Remember, a day is about a hundred thousand seconds. Next, how we measure whether a system stays up.

Key takeaways
  • Order of magnitude
  • 1 day ≈ 100k seconds
  • Find the hard part early
Next up: Availability and the Nines — how often it is up