Three different ways to talk about 'fast'. Do not mix them up.
These three words all talk about "fast", but each one means something different.
Remember: a wide pipe (high bandwidth) does not make a single request faster. Latency and bandwidth are different problems.
Latency is not one number. Some requests are fast and some are slow. So we look at percentiles: p50 (the middle request), p95 and p99 (the slow ones). If p99 is 2 seconds, then 1 in 100 users waits 2 seconds or more.
When someone says "the system is slow", we must know which kind of slow. The fix is different for each.
| Action | About how long | Feels like |
|---|---|---|
| Read from CPU cache | 1 nanosecond | Instant |
| Read from RAM | 100 nanoseconds | Very fast |
| Read from SSD | 0.1 ms (100 microseconds) | Fast |
| Round trip inside one data centre | 0.5 ms | Fast |
| Read from a spinning disk | 10 ms | Slow |
| Round trip across a continent | 50 to 150 ms | Noticeable |
| Term | Meaning in easy words |
|---|---|
| Latency | Time for one request to finish. Measured in ms. |
| Round trip time (RTT) | Time for a message to go to the server and come back. |
| Bandwidth | The maximum data per second a connection can carry. |
| Throughput | The data or requests per second that really get through. |
| Goodput | Throughput of useful data only, without resent or extra header bytes. |
| RPS / QPS | Requests (or queries) per second. |
| p50, p95, p99 | The time within which 50%, 95% or 99% of requests finish. |
| Jitter | How much the latency changes from one request to the next. |
| Packet loss | Data pieces that never arrive and must be sent again. |
| Congestion | Too much traffic on a link, so things slow down. |
| Time to first byte (TTFB) | Time until the first part of the answer arrives. |
| Choice | We gain | We lose |
|---|---|---|
| Batching requests | Higher throughput | Higher latency for each item (it waits for the batch) |
| Caching | Lower latency | Data may be old |
| Compression | Less bandwidth used | A little CPU time and latency |
| More servers | Higher throughput | More cost and complexity |
| Queues | Smooth throughput at spikes | Longer wait for the result |