Back-of-the-Envelope Estimation (Step 2 Deep Dive) โ
AdvancedAdvanced3+ yrs experience Deep technical material โ distributed-systems theory, low-level implementation details, and case studies of real production systems.Prerequisites: Production experience with at least one distributed system. Comfort reading research papers and RFCs.Time Budget: 5 minutes โ Optional but powerful. Demonstrates engineering maturity.
Back-of-the-envelope estimation is the art of making fast, structured approximations to understand the scale a system needs to handle. You don't need exact numbers โ you need the right order of magnitude.
Why It Matters โ
Estimation bridges Requirements Clarification and High-Level Design. It answers the question:
"Is this a system that handles 100 requests/sec or 100,000 requests/sec? The architecture looks completely different."
Interviewers use this phase to assess:
- Do you know your powers of two and latency numbers?
- Can you reason about scale without a calculator?
- Does your design match the scale you estimated?
The Estimation Flow โ
The Two Foundational Tables โ
Before estimating anything, internalize these two tables. They are your building blocks.
Powers of Two (Data Sizes) โ
| Power | Approx Value | Name | Example |
|---|---|---|---|
| 2^10 | 1 Thousand | 1 KB | A short text message |
| 2^20 | 1 Million | 1 MB | A compressed photo |
| 2^30 | 1 Billion | 1 GB | A standard movie file |
| 2^40 | 1 Trillion | 1 TB | A large database |
| 2^50 | 1 Quadrillion | 1 PB | A data warehouse |
Latency Numbers Every Engineer Should Know โ
| Operation | Latency | Rule of Thumb |
|---|---|---|
| L1 cache hit | ~0.5 ns | Fastest possible |
| RAM access | ~100 ns | 200ร slower than L1 |
| SSD random read | ~150 ยตs | 1,000ร slower than RAM |
| Network round trip (same DC) | ~500 ยตs | Avoid unnecessary network hops |
| HDD seek | ~10 ms | Avoid disk seeks at scale |
| Network round trip (cross-continent) | ~150 ms | User-perceived latency |
TIP
Memorize these three: RAM (100ns) โ SSD (150ยตs) โ Network same DC (500ยตs). They anchor every latency argument you'll make.
The 4 Estimation Pillars โ
Every estimation exercise covers these four areas:
Worked Example: URL Shortener โ
Using the requirements from Step 1:
- 100 million URLs shortened per day (writes)
- 10 billion redirects per day (reads)
Pillar 1 โ Throughput โ
WRITES (URL Shortening):
100 million / day
= 100,000,000 / 86,400 seconds
โ 1,160 writes/sec
Round up โ ~1,200 writes/sec
READS (Redirects):
10 billion / day
= 10,000,000,000 / 86,400 seconds
โ 115,740 reads/sec
Round up โ ~116,000 reads/sec
READ-TO-WRITE RATIO:
116,000 / 1,200 โ 100:1 โ Extremely Read-Heavy โ
Design signal: A 100:1 read-to-write ratio means we need aggressive caching (Redis/Memcached) and potentially a CDN to absorb redirect traffic. Write infrastructure can be modest.
Pillar 2 โ Storage โ
RECORD SIZE (one shortened URL entry):
short_url_hash: 7 bytes (e.g., "abc1234")
long_url: 200 bytes (average URL length)
created_at: 8 bytes (timestamp)
expiry_at: 8 bytes (timestamp)
user_id: 8 bytes (optional FK)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Total: ~231 bytes โ 500 bytes (with overhead)
DAILY NEW DATA:
100M records/day ร 500 bytes = 50 GB/day
5-YEAR TOTAL:
50 GB/day ร 365 ร 5 = ~91 TB
10-YEAR TOTAL:
50 GB/day ร 365 ร 10 = ~182 TBDesign signal: At ~182 TB over 10 years, we cannot store everything in a single database. We need database sharding or a distributed store like Cassandra or DynamoDB.
Pillar 3 โ Bandwidth โ
WRITE BANDWIDTH (inbound):
1,200 writes/sec ร 500 bytes = 600 KB/sec โ 0.6 MB/sec
โ Negligible
READ BANDWIDTH (outbound redirect responses):
116,000 reads/sec ร 500 bytes = 58 MB/sec
โ Peak could be 2โ3ร: ~120โ175 MB/sec โ ~1.4 Gbps
(A standard 10 Gbps NIC handles this on a single server,
but we still need multiple servers for fault tolerance.)Design signal: Outbound bandwidth is significant. A CDN can cache hot short URLs at the edge and absorb the majority of this traffic before it even reaches our servers.
Pillar 4 โ Memory / Cache โ
HOT URLs (20% of URLs drive 80% of traffic โ Pareto principle):
100M active URLs ร 20% = 20 million hot URLs
CACHE SIZE REQUIRED:
20 million URLs ร 500 bytes = 10 GB of cache
CACHE SERVER:
A single Redis server with 32โ64 GB RAM can hold
the entire working set โ 1-2 Redis nodes is sufficient
(with replication for HA)Design signal: Our working set fits entirely in memory. Cache-hit ratio will be very high if we use an LRU eviction policy โ this will absorb nearly all read traffic.
The Full Estimation Summary (What You Say to the Interviewer) โ
Common Estimation Shortcuts โ
These mental shortcuts keep your math fast and clean in the interview:
| Scenario | Shortcut |
|---|---|
| Seconds in a day | ~86,400 โ round to 100,000 for easy math |
| Seconds in a month | ~2.5 million โ round to 2.5M |
| Seconds in a year | ~31.5 million โ round to 30M |
| Average photo size | ~300 KB (compressed) |
| Average video (1 min, 720p) | ~50โ100 MB |
| Average tweet / short post | ~300 bytes |
| Average webpage | ~1 MB |
| Pareto Rule (80/20) | 20% of content โ 80% of reads (always assume for caching) |
Estimation Vocabulary (Say These Out Loud) โ
Using the right language shows engineering maturity:
| Instead of... | Say this... |
|---|---|
| "A lot of users" | "Assuming 500 million DAU..." |
| "Fast response" | "P99 latency under 100ms..." |
| "Big database" | "~182 TB over 10 years, so we'll need sharding..." |
| "Popular items" | "Assuming 80/20 rule, 20% of URLs account for 80% of traffic..." |
| "Maybe use cache" | "A 10 GB working set fits in Redis, so cache-hit ratio should be ~95%..." |
Red Flags vs. Green Flags โ
| ๐ด Red Flag | ๐ข Green Flag |
|---|---|
| Skip estimation entirely | Do a 3-minute estimation even if interviewer says "optional" |
| Exact, precise numbers (false confidence) | Round numbers, acknowledge they're approximations |
| Estimate then ignore the results | Let estimates drive design decisions |
| Just calculate โ don't interpret | Translate numbers into architecture signals |
| Forget to state assumptions | Explicitly say "I'm assuming X because..." |
Next Steps โ
With scale now quantified, move to Step 3: High-Level Design โ where your estimates become the foundation for every architectural decision.
IMPORTANT
Always connect your estimates to design decisions. Don't just throw numbers โ say "Because we have 100:1 read-to-write ratio, I'll add a Redis cache in front of the database." That's what separates a senior candidate from a junior one.
WARNING
Don't spend more than 5 minutes here. If you find yourself going deep into precise math, snap back to round numbers and move on.
