# Latency Numbers and Performance Metrics

> Memorise the rough cost of memory, disk, network and cross-region calls, and learn to talk about latency, throughput and percentiles. Free notes, key concepts,...

Canonical: https://www.internhack.in/roadmaps/tracks/system-design/latency-numbers
Last updated: 2026-11-28

Memorise the rough cost of memory, disk, network and cross-region calls, and learn to talk about latency, throughput and percentiles.

Beginner · about 2 hours · difficulty 2/5

Learn first: [Client-Server Model and How the Internet Works](https://www.internhack.in/roadmaps/tracks/system-design/client-server-internet)

Good designers carry a rough mental table of how long things take. You do not need exact values; you need the **orders of magnitude**.

### Numbers to remember (approximate)

- L1 cache reference: about 1 ns
- Main memory reference: about 100 ns
- Read 1 MB sequentially from memory: about 10 to 50 microseconds
- SSD random read: about 100 microseconds
- Round trip inside one data centre: about 0.5 ms
- Read 1 MB sequentially from SSD: about 1 ms
- HDD seek: about 10 ms
- Round trip Mumbai to Singapore: about 60 ms; Mumbai to US East: about 200 ms

The lessons: memory is far faster than disk, disk is faster than crossing the planet, and **network round trips usually dominate**. Batch calls, cache hot data in memory and keep chatty services close together.

### Metrics you will use

- **Latency**: time for one request. Always discuss **percentiles** (p50, p95, p99), not averages. One slow dependency can make p99 terrible while the average looks fine.
- **Throughput**: requests or bytes handled per second (QPS, RPS).
- **Utilisation and saturation**: how busy a resource is and whether work is queuing.
- **Little's law**: items in the system = arrival rate x time in system. Useful for sizing thread pools and queues.

### Tail latency

If a page calls 20 services in parallel, it is as slow as the slowest one. With fan-out, rare slow responses become common for the user. Techniques like timeouts, hedged requests and caching protect the tail.

### Pitfalls

- Quoting average latency in an interview; interviewers expect p99.
- Optimising CPU code while the request makes five sequential network calls.

You are ready to move on when you can estimate, without looking anything up, whether reading 1 GB from SSD or fetching 1 KB from another continent is slower, and explain p99.

## Key concepts

- **Memory vs disk vs network costs**
- **Latency percentiles (p50, p95, p99)**
- **Throughput and QPS**
- **Tail latency and fan-out**
- **Little's law**
- **Hedged requests**

## Mini project

Write a script that calls a public API 500 times and prints p50, p95, p99 and max latency. Then add an in-memory cache and compare the distribution before and after.

## Check yourself

A service has 50 ms average latency but 2 s p99. A page fans out to 10 such calls in parallel. Roughly how often will a user see a slow page?

## Free resources

- [Latency numbers every programmer should know](https://gist.github.com/jboner/2841832) (GitHub Gist)
- [Interactive latency numbers by year](https://colin-scott.github.io/personal_website/research/interactive_latency.html) (Colin Scott)
- [Little's law](https://en.wikipedia.org/wiki/Little%27s_law) (Wikipedia)

Previous: [HTTP, Connections and Real-Time Protocols](https://www.internhack.in/roadmaps/tracks/system-design/http-for-system-design) · Next: [Back-of-the-Envelope Estimation](https://www.internhack.in/roadmaps/tracks/system-design/back-of-envelope-estimation)

## More in System Design Foundations

- [What System Design Is (HLD vs LLD)](https://www.internhack.in/roadmaps/tracks/system-design/what-is-system-design)
- [Client-Server Model and How the Internet Works](https://www.internhack.in/roadmaps/tracks/system-design/client-server-internet)
- [HTTP, Connections and Real-Time Protocols](https://www.internhack.in/roadmaps/tracks/system-design/http-for-system-design)
- [Latency Numbers and Performance Metrics](https://www.internhack.in/roadmaps/tracks/system-design/latency-numbers)
- [Back-of-the-Envelope Estimation](https://www.internhack.in/roadmaps/tracks/system-design/back-of-envelope-estimation)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [System Design Roadmap](https://www.internhack.in/roadmaps/tracks/system-design)
