Lesson 12 of 17
5. Latency vs Throughput

Memory card and where the analogy breaks

3 min read+10 XP

The memory card (tear this page out)

#QuestionMemory code
5.1Latency?Latency is one car's trip (and say where the clock starts)
5.2Throughput?Throughput is cars past the toll booth
5.3Bandwidth vs throughput?Lanes are what's possible; the toll count is what happened
5.4Percentiles?The average describes nobody. Ask p50 how it usually goes, and p99 who's suffering.
5.5Tail latency and fan-out?Lunch waits for the slowest car
5.6Little's law?Cars on the road = cars per hour × hours on the road (L = λ × W)
5.7Where time goes?Find the toll booth before you buy a faster car
5.8Reducing latency?Skip it, batch it, move closer, avoid rush hour
5.9Increasing throughput?Widen the narrowest point
5.10When they fight?The bus moves more people, but you wait for the bus

The whole chapter in one line: Measure the trip and the toll count separately, watch the slowest car, and never run the road full.

Where the analogy breaks

  • Cars on a road don't get slower when the road is busier, except in jams. Servers do: they share CPU, memory and locks, so each request does slightly more work when the server is busy.
  • A road doesn't cancel your trip. Systems do: timeouts, dropped requests and retries mean some "cars" never arrive, and retries add even more traffic (Chapter 29).
  • A car can't be in two places. A request can: hedged requests send copies down two roads on purpose and take whichever arrives first.

Quick check

Five questions on this chapter. Pick an answer, then check it.

quiz