Try
↑ ↓ move↵ openesc close

Interview prep / Percentiles

Mid · Percentiles · System design interview question

Your latency SLO is that 99 percent of requests finish in under 300 ms. The histogram has bucket boundaries at 250 ms and 500 ms. Why is the SLI unreliable, and what do you change?

Sketch your own answer first, then compare it with the one below.

A strong answer

A bucket count tells you how many requests were at or below its boundary, so the SLI can be read exactly only at a boundary. Here the threshold of 300 ms falls inside the 250 to 500 ms bucket.

Say a window of 10,000 requests has 9,000 at or below 250 ms and 9,900 at or below 500 ms. At least 9,000 requests are certainly good, which is 90 percent, and at most 9,900 can be, which is 99 percent. The 900 in between could all sit at 260 ms or all at 490 ms. Interpolation assumes an even spread and reports 9,180, or 91.8 percent. It looks precise and rests on a guess. Whether the SLO is met could depend on that guess alone.

The remedy is to put a bucket boundary at 300 ms. With le="0.3" the good count is read directly and the ratio is exact. In general, derive bucket boundaries from your objectives, and keep a few extra ones just below them for warning thresholds. Old data cannot be re-bucketed, so add the boundary before tightening a target, not after.

Sources

Learn it by running it

The percentiles and why averages lie lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms