System Latencies at a Glance

Visualizing the vast difference in time scales between various system operations. Understanding these numbers is crucial for system design and performance optimization.

The Numbers

Approximate timing for various operations on a typical modern system.

Key / CodeDescription
L1 Cache Reference0.5 ns
Branch Mispredict5 ns
L2 Cache Reference7 ns
Mutex Lock/Unlock25 ns
Main Memory Reference100 ns
Compress 1K Bytes with Zippy3,000 ns (3 µs)
Send 2K Bytes over 1 Gbps Network20,000 ns (20 µs)
Read 1 MB sequentially from Memory250,000 ns (250 µs)
Round Trip within same Data Center500,000 ns (500 µs)
Disk Seek10,000,000 ns (10 ms)
Read 1 MB sequentially from Network10,000,000 ns (10 ms)
Read 1 MB sequentially from Disk20,000,000 ns (20 ms)
Send Packet CA -> Netherlands -> CA150,000,000 ns (150 ms)

Human Scale Analogy

If 1 CPU cycle (0.3 ns) was equal to 1 second:

Key / CodeDescription
L1 Cache Access1.5 seconds
Main Memory Access6 minutes
Solid State Drive I/O2 - 6 days
Rotational Disk I/O1 - 12 months
Internet: SF to NYC4 years
Internet: SF to UK8 years
OS Virtualization Reboot423 years

Takeaways

1. Accessing memory is fast, but reading from disk is incredibly slow by comparison. 2. Network calls within a data center are expensive compared to local memory, but cheap compared to cross-continent calls. 3. Avoid disk seeks whenever possible.

When These Numbers Matter

Use this reference when deciding whether to add a cache, batch network requests, move work closer to the database, or avoid repeated disk and cross-region calls. The exact values vary by hardware, but the relative gaps between memory, local disk, and network remain large enough to drive system design decisions.

Common Latency Mistakes

A classic mistake is treating a network call like a function call and putting it inside tight loops. Another is focusing on CPU optimization while the real bottleneck is remote I/O or disk seeks. Teams also underestimate cross-service fan-out, where one user request quietly triggers dozens of expensive downstream operations.

Related

Knowledge is power.