Why Estimate? Sizes and Speeds to Remember
Overview
Back-of-the-envelope estimation is quick, rough maths that tells you the size of a problem: is it 100 requests a second or 100,000? 10 GB of data or 10 PB? You do not need exact answers, only answers close enough to choose the right design.
Detailed Notes
What is estimation
It is rough calculation on paper, using round numbers and clearly stated assumptions. The goal is order of magnitude: being off by 2x is fine, being off by 1000x is not.
The problem it solves
A design for 100 requests per second (one small server) looks nothing like a design for 100,000 (many servers, caching, sharding). Without numbers you either over-build (waste money) or under-build (outages). Estimation also exposes impossible ideas early: if the maths says you need 500 TB of RAM, rethink the idea.
How it works
1. Know the sizes. Every step up the ladder multiplies by about 1,000:
- 1 KB (kilobyte) is about a thousand bytes
- 1 MB (megabyte) is about a million bytes
- 1 GB (gigabyte) is about a billion bytes
- 1 TB (terabyte) is about a trillion bytes
- 1 PB (petabyte) is about a quadrillion bytes
A byte is 8 bits. Network speed is quoted in bits per second (Mbps, Gbps) and storage in bytes, so divide bits by 8 to get bytes. Mixing them up gives 8x errors.
Typical item sizes: a text post with metadata is a few hundred bytes, a compressed photo is 200 KB to 3 MB, and a minute of HD video is tens of MB. Media dwarfs text.
2. Know the time shortcuts.
- Seconds in a day: 86,400, rounded to about 100,000 (10^5).
- So divide requests per day by 100,000 to get requests per second: 1 million a day is about 10 a second; 1 billion a day is about 10,000 a second.
- Peak traffic is usually 2 to 3 times the average. Design for the peak.
3. Know the latency numbers. These are rounded, but the ratios matter:
- Read from memory (RAM): about 100 nanoseconds
- Random read from an SSD: about 100 microseconds
- Round trip inside one data centre: about 0.5 milliseconds
- Disk seek (spinning drive): about 10 milliseconds
- Round trip across continents: about 150 milliseconds
What they teach:
- Memory is about 1,000x faster than an SSD, which is why caches exist.
- Network trips cost far more than computing, so avoid many sequential calls, especially across regions.
- Light is slow over long distances, so put data near users (a CDN).
A simple example
A product manager says: "We expect 10 million daily users on a photo app." On paper, in two minutes: each user views 50 photos, which is 500 million views a day, or about 5,800 requests per second. Each thumbnail is about 200 KB, so that is roughly 9 Gbps of outgoing traffic. One server cannot do that.
System design example
That quick result already shapes the architecture: a CDN must serve the images, object storage holds the photos, and a cache protects the database. The estimate decided this before any code was written. State your assumptions out loud; if one changes, the numbers can be redone in seconds.
Summary
- Estimation finds the size of a problem so you choose the right design.
- Each size unit is about 1,000x the last; bits are 1/8 of a byte.
- One day is about 100,000 seconds; plan for 2-3x peak.
- Memory is far faster than disk or network; long-distance trips are slow.
Architecture Diagram
From assumptions to a design decision.
- 1Write down assumptions: users, actions per user, item sizes.
- 2Round to friendly numbers and keep units.
- 3Calculate, noting averages and peaks.
- 4Decide which components the numbers require.
Common Interview Questions
Finished this lesson?
0 of 91 lessons done · 0% of the course

