Skip to main content
← CONCEPTS / SYSTEM DESIGN & ARCHITECTURE
An end-to-end domain learning journey

Back-of-the-Envelope
Estimation.

Size QPS, storage, memory, and network bandwidth in seconds using powers-of-two byte units and Jeff Dean's latency numbers every engineer should know.
Start the journey2 sections
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

When traffic spikes expose hidden coupling, memorize key anchors ($1\text{ day} \approx 86{,}400\text{ s} \approx 10^5\text{ s}$, $1\text{ KB} = 2^{10}$, L1 cache $\approx 1\text{ ns}$, RAM $\approx 100\text{ ns}$, NVMe SSD $\approx 100\text{ }\mu\text{s}$, cross-continent RTT $\approx 150\text{ ms}$) to sanity-check architectures before writing code.

TL;DR30-second simplified summary
▾

In system design interviews and production capacity reviews, a 60-second back-of-the-envelope calculation immediately tells you whether a dataset fits in single-node RAM (Redis), requires SSD-backed sharding.

Memorize key anchors (1 day≈86,400 s≈105 s1\text{ day} \approx 86{,}400\text{ s} \approx 10^5\text{ s}, 1 KB=2101\text{ KB} = 2^{10}, L1 cache ≈1 ns\approx 1\text{ ns}, RAM ≈100 ns\approx 100\text{ ns}, NVMe SSD $\approx 100\text{.

Full walkthrough · 2 stages
01
SYSTEM DESIGN & ARCHITECTURE · STAGE 01L4 · FUNDAMENTALS

The idea & core mechanics.

Why this matters: Size QPS, storage, memory, and network bandwidth in seconds using powers-of-two byte units and Jeff Dean's latency numbers every engineer should know.

In system design interviews and production capacity reviews, a 60-second back-of-the-envelope calculation immediately tells you whether a dataset fits in single-node RAM (Redis), requires SSD-backed sharding, or saturates a 10 Gbps NIC.

ChoiceWhat it buysWhat it costs
Good candidateFirst 5 minutes of any system design interview to establish QPS, peak QPS (2–3x average), 5-year storage, and cache RAM.
Good candidateProduction architecture reviews to verify network egress, IOPS, and memory budgets.
Think twiceSpending 15 minutes doing exact arithmetic in an interview—round aggressively to powers of 10 and powers of 2.

Principle 1

Powers of 2: 210=1 KB2^{10} = 1\text{ KB}, 220=1 MB2^{20} = 1\text{ MB}, 230=1 GB2^{30} = 1\text{ GB}, 240=1 TB2^{40} = 1\text{ TB}, 250=1 PB2^{50} = 1\text{ PB}.

Principle 2

Time shortcuts: 1 day=86,400 s≈105 s1\text{ day} = 86{,}400\text{ s} \approx 10^5\text{ s}; 1 month≈2.5×106 s1\text{ month} \approx 2.5 \times 10^6\text{ s}; 1 year≈3×107 s1\text{ year} \approx 3 \times 10^7\text{ s}.

Principle 3

Latency ladder: L1 cache (~1 ns) < RAM (~100 ns) < 1 Gbps LAN (~500 us) < NVMe SSD random read (~100 us) < HDD seek (~10 ms) < Cross-continent packet (~150 ms).

Principle 4

80-20 rule for caching: caching the hottest 20% of daily traffic in RAM typically serves ~80% of reads.

02
SYSTEM DESIGN & ARCHITECTURE · STAGE 02L5 · APPLIED DESIGN

Walkthrough & implementation.

Step-by-step execution mechanics and reference implementation for Back-of-the-Envelope Estimation.

Architecture & Trade-Off Matrix

Operation Approx. Latency Relative Scale
L1 Cache Reference ~1 ns 1x
Main Memory (RAM) Reference ~100 ns 100x
Compress 1 KB with LZ4/Snappy ~3 us 3,000x
NVMe SSD Random Read (4 KB) ~100 us 100,000x
Same-AZ / Datacenter Round-Trip ~500 us (0.5 ms) 500,000x
HDD Seek ~10 ms 10,000,000x
US West -> Europe Round-Trip ~150 ms 150,000,000x

Reference Implementations (Python & Java)

# Quick QPS, Peak QPS, and 5-year Storage Estimator (Python)
def estimate_system(dau: int, reqs_per_user_day: int, bytes_per_write: int, write_ratio: float = 0.1):
    avg_qps = (dau * reqs_per_user_day) / 86_400
    peak_qps = avg_qps * 3
    daily_write_bytes = dau * reqs_per_user_day * write_ratio * bytes_per_write
    five_year_tb = (daily_write_bytes * 365 * 5) / (1024 ** 4)
    return {"avg_qps": round(avg_qps, 1), "peak_qps": round(peak_qps, 1), "storage_5yr_tb": round(five_year_tb, 2)}
// Quick QPS and 5-year Storage Estimator (Java)
public static Map<String, Double> estimate(long dau, int reqsPerDay, int bytesPerWrite, double writeRatio) {
    double avgQps = (dau * (double) reqsPerDay) / 86_400.0;
    double peakQps = avgQps * 3.0;
    double dailyBytes = dau * (double) reqsPerDay * writeRatio * bytesPerWrite;
    double fiveYearTb = (dailyBytes * 365.0 * 5.0) / Math.pow(1024, 4);
    return Map.of("avgQps", avgQps, "peakQps", peakQps, "storage5YrTb", fiveYearTb);
}
Recommended Learning Flow