01.2 Latency numbers every engineer must know

Intern · Fundamental

Core idea

Intuition requires knowing the rough cost of each operation. Without these numbers in your head, you cannot reason about whether a design is fast or slow.

Mental model

Analogy: Think in orders of magnitude. L1 cache is a blink (1ns). RAM is a heartbeat (100ns). SSD is a second of thought (0.1ms). Network in same datacenter is a short sentence (0.5ms). Cross-continental network is a short conversation (150ms). Disk seek is a nap (10ms).

Why it matters

  • You need these to do back-of-envelope estimates in interviews
  • They tell you instantly whether a design decision is reasonable
  • They reveal why certain architectures exist (e.g., why we cache: RAM vs network gap)

What to know

  • L1 cache: ~1ns | L2: ~4ns | RAM: ~100ns
  • SSD random read: ~0.1ms | HDD seek: ~10ms
  • Same-DC network: ~0.5ms | Cross-region: ~50–150ms
  • Mutex lock: ~100ns | Context switch: ~1–10μs
  • Compress 1KB: ~3μs | Send 2KB over 1Gbps: ~20μs

Common traps

  • Assuming network is fast — it is not, relative to memory
  • Forgetting that disk I/O multiplies under concurrent load
  • Not accounting for serialization/deserialization cost

Recognise it

Recognition trigger: When asked ‘is this fast enough?’ — map it to these numbers. If your design requires 5 cross-region calls per user request, that’s 750ms minimum latency. Red flag.

Practice question

Why is Redis faster than a database? What makes it so?

Apply at work

Answer these for the system you work on.

Go deeper