LatencyL1 CacheRAMSSDHDDNetworkPerformanceStorage Hierarchy

Latency Reference

Understand the latency hierarchy — from L1 cache to network round trips. Build the intuition for why caching, batching, and data locality drive every system design decision.

25 min read9 sections
01

The Big Picture — What Is Latency?

Latency is the time it takes for an operation to complete — the delay between asking for something and getting it. In backend systems, latency determines how fast your API responds, how quickly your database returns results, and ultimately how snappy your product feels to users.

The critical insight is that not all operations are created equal. Reading from CPU cache is 100,000x faster than reading from disk. A network round trip to another continent is 1,000,000x slower than reading from RAM. These aren't small differences — they're orders of magnitude that fundamentally shape how systems are designed.

🏃

The Distance Analogy

Imagine you need to fetch a piece of information. L1 cache is reaching into your pocket — instant, you already have it. L2 cache is grabbing something from your desk — a quick reach. RAM is walking to the bookshelf across the room — a few seconds. SSD is driving to a nearby warehouse — minutes. HDD is driving to a warehouse across town, but the warehouse uses a mechanical crane to find your item — much slower. Network round trip is flying to another city, finding the item, and flying back. Same-region network is a short domestic flight. Cross-continent is an international flight. Every system design decision is about keeping data as close to 'your pocket' as possible.

🔥 Why This Matters

Every system design interview involves latency trade-offs. "Why use a ?" Because RAM is 100x faster than SSD. "Why use a ?" Because a nearby server is 10x faster than a distant one. "Why denormalize?" To avoid an extra disk read. If you internalize these numbers, every design decision becomes intuitive.

1 / 9