← All calculators
Latency numbers to know
The classic table of cache, memory, disk and network latencies, as raw values or scaled to human time, with the orders of magnitude that matter in an estimate.
The table
Approximate latency of one operation.
| Operation | Latency | Relative size, log scale |
|---|---|---|
| CPU and memory | ||
| L1 cache reference | 1 ns | |
| Branch mispredict | 3 ns | |
| L2 cache reference | 4 ns | |
| Uncontended mutex lock/unlock | 20 ns | |
| Main memory reference | 100 ns | |
| Compress 1 KB with a fast codec | 2 µs | |
| Read 1 MB sequentially from memory | 50 µs | |
| Storage | ||
| SSD random read (4 KB) | 100 µs | |
| Read 1 MB sequentially from SSD | 300 µs | |
| Read 1 MB sequentially from HDD | 5 ms | |
| HDD seek | 10 ms | |
| Network | ||
| Send 1 KB over a 10 Gbps link | 1 µs | |
| Round trip in the same datacenter | 500 µs | |
| Send 1 MB over a 10 Gbps link | 1 ms | |
| Round trip between availability zones | 1 ms | |
| Round trip across a continent | 60 ms | |
| Round trip across an ocean | 150 ms | |
These are orders of magnitude, not benchmarks. Hardware, cloud network disks and distance all shift them; what stays true is the ratio between rows.
How this is calculated
- Human scale
human time = real time × 10⁹, because an L1 hit is about 1 ns: one nanosecond becomes one second, one millisecond becomes about 11.6 days.- Ratios worth memorising
- Memory is about 1,000× faster than an SSD random read, which is about 100× faster than an HDD seek. A datacenter round trip is about 5,000 memory references.
- Throughput from latency
max sequential ops/s ≈ 1 ÷ latency: one client doing cross-ocean round trips one after another manages about 7 a second.- Bandwidth
time = bytes × 8 ÷ link bits/s: 1 MB on a 10 Gbps link is about 0.8 ms before any round trips.
What to say in the interview
- “A memory read is about 100 nanoseconds and a round trip inside the datacenter is about half a millisecond, so one network hop costs as much as thousands of memory reads. That’s why I want the hot path to be one cache lookup, not a chain of calls.”
- “Crossing an ocean is around 150 milliseconds per round trip, so a request can afford one of those at most; anything that needs several has to be served from a nearby region.”
- “Sequential disk reads are far cheaper than random ones, which is why I’d lean on an append-only log and batch writes rather than update rows in place.”