Notes

Part 4 of 9

Using response time numbers

Guess first

A page calls 5 backend services at once, and each one is slow 1 time in 100. How often is the page slow?

A page calls 5 backend services at once, and each one is slow 1 time in 100. How often is the page slow?
  • High percentiles matter most for backend services that are called many times for one user request.
  • Even if you call them in parallel, the user request waits for the slowest call. One slow call makes the whole page slow.
  • Tail latency amplification: the more backend calls a page needs, the more likely at least one is slow. So a bigger share of user requests end up slow.
  • A service level objective (SLO) is a target for performance and availability, often written in percentiles. Example: median under 150 ms, p99 under 800 ms, and at least 99.9% of valid requests return without an error.
  • A service level agreement (SLA) is a contract that says what happens if the SLO is missed, such as a refund.

Waiting for the slowest call

Step 1 of 5

One page asks 5 backend services for its parts, all at the same time.

Computing percentiles

  • Dashboards show percentiles over a moving window, such as the last 10 minutes, updated every minute.
  • The simple way is to keep every response time in the window and sort them each minute.
  • Cheaper approximate methods give good estimates with little CPU and memory.
  • Never average percentiles, either across machines or across time windows. The math does not work. Add up the histograms instead, then read the percentile from the total.