Latency Numbers & the Memory Hierarchy
Rough timings for memory, disk and network that make back-of-the-envelope design possible.
Every data access lands somewhere in the memory hierarchy, and each level is roughly an order of magnitude slower than the one before. Knowing the rough numbers lets you spot an impossible design in seconds.
The figures below are order-of-magnitude guides on modern hardware, not benchmarks. What matters is the ratio: RAM is about 100× faster than an SSD read, and a same-datacentre round trip is about 1,000× faster than crossing an ocean.
Diagram
How it works
- Estimate request volume: daily users × actions per user ÷ 86,400 seconds.
- Estimate data size: records per day × bytes per record × retention days.
- Place hot data in the fastest level you can afford (memory cache), cold data on disk or object storage.
- Count network hops on the critical path; each one adds latency and a failure point.
Key concepts
- Latency
- Time for one operation to complete, e.g. one request round trip.
- Throughput
- How many operations complete per second. High throughput does not imply low latency.
- Tail latency
- The slowest requests (p95, p99). Users notice the tail, and fan-out calls amplify it.
- Locality
- Data accessed together should be stored together so caches stay effective.
Trade-offs
Benefits
- Fast sanity checks during design and interviews
- Explains why caching and batching work
- Highlights where to spend optimisation effort
Costs
- Real numbers vary by hardware, cloud and load
- Easy to over-optimise the wrong layer without measuring
Use it when
- Back-of-the-envelope capacity planning
- Deciding whether a cache, CDN or replica in another region is worth it
Common mistakes
- Chatty services making dozens of sequential network calls per request
- Treating averages as the user experience — look at p99
- Forgetting serialisation and TLS handshakes add to network time
Interview questions
Q1A page makes 20 sequential calls to a service in the same datacentre. What is the minimum latency?
Q2Why is reading from RAM so much faster than reading from an SSD?
Q3Why does tail latency matter more in microservices?
Related lessons
Rules for Low-Latency Systems
Practical habits that keep response times low and predictable under load.
Scalability & PerformanceCaching Strategies
Keep frequently read data close and fast, and decide carefully how it stays fresh.
FoundationsBig-O Notation & Time Complexity
A shared language for how the cost of an algorithm grows as its input grows.