SDI.

Scale Lab

Back-of-the-envelope calculators and reference tables for systems design estimation.

Calculators

Reference Tables

Latency Numbers Every Programmer Should Know

Key latency figures for reasoning about system performance. Originally compiled by Jeff Dean and updated for modern hardware. Invaluable for back-of-envelope calculations in system design interviews.

OperationLatencyNanoseconds(ns)CategoryNotes
L1 cache reference0.5 ns0.5CPUFastest memory access; data already in the CPU core's local cache
Branch mispredict5 ns5CPUPipeline flush and restart cost when CPU predicts wrong branch
L2 cache reference7 ns7CPU~14x L1 cache; shared between cores on most architectures
L3 cache reference20 ns20CPUShared across all cores; last level before main memory
Mutex lock/unlock25 ns25OSUncontended; contended locks can be orders of magnitude slower
Main memory reference (DRAM)100 ns100Memory~200x L1 cache; DDR5 typical latency
Compress 1 KB with Snappy3,000 ns (3 us)3000CPUSnappy prioritizes speed over compression ratio
Send 1 KB over 1 Gbps network10,000 ns (10 us)10000NetworkRaw bandwidth cost; does not include round-trip overhead
Read 4 KB randomly from SSD16,000 ns (16 us)16000StorageNVMe SSD; SATA SSD is ~100 us
Read 1 MB sequentially from memory250,000 ns (250 us)250000Memory~62.5 GB/s effective bandwidth for sequential read
Round trip within same datacenter500,000 ns (500 us)500000Network~0.5 ms; typical for service-to-service calls within a region
Read 1 MB sequentially from SSD1,000,000 ns (1 ms)1000000StorageNVMe SSD; ~1 GB/s effective sequential throughput
HDD seek4,000,000 ns (4 ms)4000000StorageMechanical disk; seek time dominates random I/O
Read 1 MB sequentially from HDD5,000,000 ns (5 ms)5000000Storage~200 MB/s sequential; good for throughput, bad for random I/O
Read 1 MB sequentially from network (1 Gbps)10,000,000 ns (10 ms)10000000NetworkDominated by bandwidth limit of 1 Gbps link
Redis GET (in-memory, local datacenter)500,000 ns (0.5 ms)500000Data StoreTypical for a cache hit; includes network round trip
Simple database query (indexed)5,000,000 ns (5 ms)5000000Data StoreSimple key lookup on indexed column; varies widely by engine
Send packet CA -> Netherlands -> CA150,000,000 ns (150 ms)150000000NetworkTransatlantic round trip; limited by speed of light in fiber
TLS handshake250,000,000 ns (250 ms)250000000NetworkTLS 1.2 full handshake (2 round trips); TLS 1.3 is ~1 RTT
Retry with exponential backoff (1st retry)1,000,000,000 ns (1 s)1000000000ApplicationCommon starting point for retry delays; doubles each attempt

Powers of 2

Essential reference for back-of-envelope calculations. Every systems designer should know these by heart: how many bytes in a kilobyte, megabyte, gigabyte, and beyond.

PowerExact ValueApprox ValueCommon Name
2^011
2^122
2^244
2^388
2^41616
2^53232
2^66464
2^7128128
2^8256256
2^9512512
2^101,024~1 Thousand1 KB (Kilobyte)
2^112,048~2 Thousand2 KB
2^124,096~4 Thousand4 KB
2^138,192~8 Thousand8 KB
2^1416,384~16 Thousand16 KB
2^1532,768~32 Thousand32 KB
2^1665,536~64 Thousand64 KB
2^17131,072~128 Thousand128 KB
2^18262,144~256 Thousand256 KB
2^19524,288~512 Thousand512 KB
2^201,048,576~1 Million1 MB (Megabyte)
2^212,097,152~2 Million2 MB
2^224,194,304~4 Million4 MB
2^238,388,608~8 Million8 MB
2^2416,777,216~16 Million16 MB
2^2533,554,432~32 Million32 MB
2^2667,108,864~64 Million64 MB
2^27134,217,728~128 Million128 MB
2^28268,435,456~256 Million256 MB
2^29536,870,912~512 Million512 MB
2^301,073,741,824~1 Billion1 GB (Gigabyte)
2^312,147,483,648~2 Billion2 GB (max signed 32-bit int)
2^324,294,967,296~4 Billion4 GB (max unsigned 32-bit int)
2^338,589,934,592~8 Billion8 GB
2^3417,179,869,184~16 Billion16 GB
2^3534,359,738,368~32 Billion32 GB
2^3668,719,476,736~64 Billion64 GB
2^37137,438,953,472~128 Billion128 GB
2^38274,877,906,944~256 Billion256 GB
2^39549,755,813,888~512 Billion512 GB
2^401,099,511,627,776~1 Trillion1 TB (Terabyte)

Command Palette

Search for a command to run...