What is the difference between latency and throughput?
EasyConceptScalability & Performance
Answer
Latency is the time taken to complete one operation, such as 120 ms for an API call. Throughput is the number of operations completed per unit of time, such as 5,000 requests per second. They are related but distinct: batching can raise throughput while increasing the latency of each individual item.
- Percentiles: report p50, p95 and p99 latency rather than the average, because averages hide the slow tail that real users notice.
- Tail latency matters more as fan-out grows: a page that calls 50 services is only as fast as the slowest response.
- Little's law: requests in flight = throughput × average latency, which helps size thread pools and connection pools.