System Design Fundamentals
11 items
11 items
The math every engineer needs for system design interviews and capacity planning
Back-of-envelope calculations help you estimate system capacity, storage needs, and bandwidth requirements without precise data. Master the key numbers: powers of 2, latency figures, and throughput benchmarks. The goal isn't exact answers—it's getting within an order of magnitude to validate designs and identify bottlenecks. A 10x error is acceptable; a 1000x error means your design is fundamentally wrong.
Know these cold: 2^10 = 1K, 2^20 = 1M, 2^30 = 1G, 2^40 = 1T. When someone says "1 million users," you should instantly think "2^20" and know that fits in 20 bits. This mental math is the basis of all capacity planning.
Memory access is 100ns. SSD read is 100us (1000x slower). Network round-trip is 500us. Disk seek is 10ms (100,000x slower than memory). These ratios explain why we cache, use SSDs, and avoid cross-datacenter calls in hot paths.
Daily Active Users (DAU) -> requests/day -> requests/second. 100M DAU with 10 actions/day = 1B requests/day = ~12K QPS average, ~36K QPS peak (3x). From QPS, calculate storage, bandwidth, and server count.
Every system designer must memorize powers of 2. These numbers appear constantly in capacity planning, data sizes, and addressing.
| Power | Exact Value | Approximate | Common Name | |-------|-------------|-------------|-------------| | 2^10 | 1,024 | 1 Thousand | 1 KB | | 2^20 | 1,048,576 | 1 Million | 1 MB | | 2^30 | 1,073,741,824 | 1 Billion | 1 GB | | 2^40 | 1,099,511,627,776 | 1 Trillion | 1 TB | | 2^50 | ~1 Quadrillion | 1 PB |
Useful conversions:
1 byte = 8 bits
1 ASCII character = 1 byte
1 Unicode character = 2-4 bytes
1 integer = 4 bytes (32-bit) or 8 bytes (64-bit)
1 UUID = 16 bytes (128 bits)
1 IPv4 address = 4 bytes
1 IPv6 address = 16 bytes
1 timestamp = 8 bytesQuick mental math:
2^10 ~= 10^3 (off by 2.4%)
2^20 ~= 10^6
2^30 ~= 10^9
So: 2^32 = 2^30 x 2^2 ~= 4 x 10^9 = 4 billion
(actual: 4,294,967,296)