Tail latency: what we would tell our past selves
Every now and then we go back over old incidents about tail latency and ask what those share. These lessons are the result for now.
What We Learned
-
Heavy tails typically grow from events that strike once in a while: an occasional GC pausing, a lookup that misses and goes to disk; or some lock held by one heavy query.
-
Issuing a backup copy of a call at another server if the first request goes beyond the usual latency trims the tail for some additional calls.
-
Bucket counts keep the shape of the timing curve, while pre-aggregated p99 numbers won't merge in any honest way.
histogram_quantile(0.99,
sum by (le, route) (rate(http_request_duration_seconds_bucket{job="azure-billing"}[10m])))
# alert when the tail stays above 800 ms
histogram_quantile(0.99, sum by (le, route) (rate(http_request_duration_seconds_bucket{job="azure-billing"}[10m]))) > 0.8