1.Latency vs throughput
Latency is how long one request takes, end to end. Throughput is how many requests the system completes per unit of time. They are different axes — a system can raise one while lowering the other.
Key features
- Latency: time for one operation, start to finish — measured in ms or s
- Throughput: completed operations per unit time — measured in req/s, ops/s
- Adding parallel capacity (more servers, more lanes) raises throughput, not latency
- A faster single operation (a quicker query, less network hop) lowers latency, not necessarily throughput
- A design can optimize for one at the expense of the other — batching raises throughput but adds latency per item
Latency vs throughput
- Latency
- Time for ONE car to drive the highway end to end
- Measured in ms or s
- Lowered by a faster route, fewer hops
- Throughput
- Cars passing a checkpoint per hour
- Measured in req/s, ops/s
- Raised by adding lanes (parallel capacity)
Command
latency = time for ONE operation (ms, s)
throughput = operations completed / unit time (req/s)
raising concurrency raises throughput without
necessarily changing latencyLatency = time for one operation; throughput = operations per unit time. More parallel capacity raises throughput, not latency.