CONCEPT SHEET · Concepts

Latency vs Throughput

One-liner: Latency is time per request; throughput is requests per time; they are independent, and the tail of the latency distribution is what users feel.

ArticleConcepts© Arthur Bernier Jr551 words1 code block

Say this#

How it works#

TEXT
Little's Law:  L = λ W  1,000 req/s × 0.2 s per request  = 200 requests in flight -> need ≥200 concurrent workers/connections  pool of 50 connections, 20 ms per query -> max 50 / 0.02 = 2,500 queries/s Fan-out tail:  P(at least one of 100 backends is in its p99) = 1 - 0.99^100 ≈ 63%
  1. Measure latency as a histogram; report percentiles per endpoint.
  2. Throughput capacity = concurrency / service time; add workers or cut service time.
  3. Keep utilization under ~70-80% to keep queueing latency bounded.
  4. Attack the tail: timeouts, hedging, avoiding fan-out, warming caches, tuning GC, isolating noisy neighbors.

Averages lie: mean of [1,1,1,1,1,1,1,1,1,100] ms is ~11 ms; p50 is 1 ms, p90 is 100 ms. The user who hit 100 ms doesn't care about the mean.

Trade-offs#

ChoiceProCon
BatchingHigher throughputHigher per-item latency
Pipelining / async IOThroughput without more threadsComplexity; HOL blocking if ordered
Hedged requestsCuts tail latencyExtra load (cap at ~5% of requests)
Running at high utilizationCheaperLatency spikes; no headroom for bursts
CachingCuts median and tailStaleness; cold-start misses
Bigger machinesLower latency per opCost; single-node ceiling

Numbers#

  • Same-DC RTT ~0.5 ms; cross-continent ~150 ms; human-perceptible ~100 ms; "instant" < 100 ms.
  • 1 Gbps link ≈ 125 MB/s; 10 Gbps ≈ 1.25 GB/s. Transferring 1 GB over 1 Gbps ≈ 8 s regardless of latency.
  • Queueing: at 50% utilization wait ≈ 1x service time; at 90% ≈ 9x (M/M/1).
  • Commonly quoted web SLOs: p99 < 200-500 ms for APIs; p50 < 100 ms.

In the interview#

See also