Full answer
Definitions
- Latency: the time for a single operation, for example 120 ms from when a student taps "Show marks" to when the page shows them.
- Throughput: the amount of work done per unit of time, for example 2,000 requests per second, or 500 MB/s of disk writes.
A highway is a common picture. Latency is how long one car takes to drive from A to B. Throughput is how many cars pass a point each minute. Adding lanes increases throughput without making any single car faster.
How they relate
Little's Law connects them for a stable system:
concurrency = throughput x latency
If an API server handles 1,000 requests/s and each takes 0.2 s, then on average 1,000 x 0.2 = 200 requests are in progress at once. If your thread pool only allows 100 concurrent requests, you can serve at most 100 / 0.2 = 500 requests/s. To go higher, you either cut latency or allow more concurrency.
They also trade against each other:
- Batching (sending 100 rows in one database write) raises throughput but makes each item wait for the batch, so latency goes up.
- As utilisation approaches 100%, queues build up and latency grows sharply. Systems usually run with headroom for this reason.
Measuring latency properly
Report percentiles, not just the average. p50 is the median, p99 is the time that 99% of requests beat. An average of 80 ms can hide a p99 of 2 s. When one page calls 20 backend services, the slow tail of any one of them shows up often in the page time, so p99 matters a lot.
When each matters
- Interactive apps (search, checkout) care most about tail latency.
- Batch jobs (nightly report of attendance, log processing) care most about throughput.
By level
Fresher: Define both with units and an everyday example. Explain that a system can have high throughput and still feel slow to one user. Mentioning that averages hide slow requests is a plus.
Mid: Use Little's Law to size a thread pool or connection pool, and explain batching and queueing effects. Talk in percentiles and explain why averages mislead. One worked Little's Law calculation should appear.
Senior: Discuss tail latency amplification in fan-out, hedged requests, load shedding and how to set latency SLOs per percentile. Connect utilisation targets to capacity planning and cost. The answer should end with how these numbers feed an SLO.
Key points
- Latency = time per request; throughput = requests per unit time
- Little's Law: concurrency = throughput x latency
- Batching raises throughput but adds latency
- Latency rises sharply near full utilisation
- Use percentiles such as p50, p95 and p99, not only averages
Common mistakes
- Using the words as synonyms
- Reporting only the average latency
- Assuming lower latency always means higher throughput
- Forgetting queueing delay as load increases
Follow-ups
- Why does p99 latency matter more when one request fans out to many services?
- How would you raise throughput of a service that is CPU bound?
- What is the difference between bandwidth and throughput?
Tips
- Give the highway or canteen analogy in one line, then switch to numbers
- Quote Little's Law and do one small calculation
- Mention percentiles without being asked
Evaluation rubric
- Correct definitions with units
- Explains the relationship (concurrency or queueing)
- Mentions at least one trade-off such as batching
- Talks about percentiles or tail latency