CoursesBackend engineering from first request to production

Puzzle 15 · 16 of 18

Which users felt the slowdown?

Compare request durations, failures and resource pressure.

All puzzles in this course

The problem

Response time is elapsed time from sending a request to receiving its response. A route usually answers in ten milliseconds. Six of a hundred requests now take two hundred. Which measurement exposes the slow group?

See it

Which users felt the slowdown? 100 calls Sort Rank 95 200 ms

Scroll sideways to see the full diagram.

  1. Collect a fixed sample.

    Step 1 of 4
  2. Order durations from fastest to slowest.

    Step 2 of 4
  3. Locate observation ninety-five.

    Step 3 of 4
  4. Six slow calls put that observation in the slow group.

    Step 4 of 4

The building block

Sort the hundred timings. Using nearest rank, the ninety-fifth percentile is the value at position 95. Here it is 200 milliseconds even though the mean is only 21.4. Record request count and failures separately. A fast error can lower mean response time while availability worsens. A log gives details for one event, a metric aggregates events, and a trace connects steps of one request. Compare a database span with total request time before blaming the database.

Calculate the threshold by hand

For 94 requests at 10 ms and six at 200 ms, total time is 2,140 ms across 100 requests. The mean is 21.4 ms. In sorted order positions 1 through 94 are fast and position 95 is slow. Change one slow request into a fast one: the 95th position drops to 10 ms while five callers still wait 200 ms. Alongside the percentile record the sample size, time window and outcomes. To combine two groups, combine their timings or compatible counts per duration range. Averaging the groups' percentile numbers loses how many requests each supplied.

Try it

Run the browser experiment

Optional local lab

Run the response-time fixture. Reduce the slow group to five and predict the nearest-rank result. Write a service objective with a time window and an error threshold.

Open the local exercise files

Check yourself

All failed requests return quickly. Which signal is essential alongside response time?

Not quite. Fast failures still hurt availability. Re-read that part ↑

Right. A percentile describes an ordered sample. Averages can hide a slow group.

Five of a hundred requests take 200 ms and the others take 10 ms. What is nearest-rank p95?

Not quite. In this sample position 95 is still fast. Re-read that part ↑

Right. In this sample position 95 is still fast.

One slow request lasts 200 ms but its database span is 15 ms. What does that establish?

Not quite. A measured part must be compared with the complete request. Re-read that part ↑

Right. A measured part must be compared with the complete request.

Sources

What you now know

A percentile describes an ordered sample. Averages can hide a slow group.