Scrivio Interview library
DebuggingFoundations6 min read · updated 12 November 2026

A latency dashboard shows the average response time is 80 ms, yet users complain the service is slow. What might the dashboard be hiding, and what would you add?

An average hides the tail: if most requests take 50 ms and one in a hundred takes 3 seconds, the mean is still about 80 ms while every heavy user hits the slow ones. We add p95 and p99 from histograms and look at the distribution, break latency down by endpoint, status and instance so a slow endpoint or a bad instance cannot hide in the aggregate, check that timed-out and failed requests are counted at all, and compare with gateway or client measurements, which include network and queueing time the service never sees.

Why this question is asked

This is one of the most common gaps between dashboards and user experience. The panel is green, the number looks healthy, and support tickets keep arriving. The cause is almost never that users are wrong; it is that the dashboard measures something that cannot show their pain. Interviewers ask this debugging question to see whether we understand what an average does to a distribution and what else a server-side measurement leaves out. In this answer, we will work through the arithmetic of an average, add percentiles, break the numbers down, look for requests that are not counted, and compare with measurements from outside the service.

1What an Average Does to a Distribution

An average, or mean, adds all the values and divides by their count. It is pulled toward wherever most of the values are. When 99 requests are fast and 1 is very slow, the slow one barely moves the mean. Let us put real numbers on it.

Text
99 requests x 50 ms = 4,950 ms
1 request x 3,000 ms = 3,000 ms
mean = 7,950 / 100 = 79.5 ms // dashboard shows about 80 ms
p50 = 50 ms
p99 = 3,000 ms // one request in a hundred takes 3 seconds

Now think about who sees the slow request. A user loading a page that makes 20 API calls has a good chance that at least one of them is slow: 1 - 0.99^20 is about 18 percent of page loads. So a tail that looks like 1 percent on the dashboard becomes almost one page in five for the user. That is why the user complaints and the 80 ms average can both be true.

2Adding Percentiles From Histograms

A percentile tells us how slow the slowest share of requests is. p95 means 95 percent of requests were faster than this value, and p99 means 99 percent were. We get them in Spring Boot by enabling the percentile histogram for the HTTP server timer, so the backend can compute percentiles correctly across all instances.

Properties
# application.properties
management.metrics.distribution.percentiles-histogram.http.server.requests=true
# PromQL: p99 per endpoint across instances
histogram_quantile(0.99, sum by (le, uri) (rate(http_server_requests_seconds_bucket[5m])))
# /search -> 2.8 s <- the hidden problem
# /orders/{id} -> 0.09 s

A heat map of the latency histogram is also worth adding. It shows the whole distribution over time, and a second band of slow requests, for example around 3 seconds, often points straight at a timeout or a retry somewhere downstream.

3Breaking It Down by Endpoint, Status and Instance

One number for the whole service mixes very different things. A fast, high-volume health or lookup endpoint can dominate the average and hide a slow, low-volume endpoint that users actually wait on. Splitting by the uri tag shows each endpoint separately.

Splitting by status matters too: errors are often fast (a 500 returned in 5 ms) or very slow (a 504 after a 30-second timeout), and either kind distorts the success latency. Splitting by instance finds the one pod on a noisy node, with a long GC pause or a cold cache, that serves a third of its requests slowly. In a fleet of 20 instances, one bad instance is 5 percent of traffic, enough to ruin p99 while leaving the average almost untouched.

Same service, broken down
ViewAveragep99What it shows
Whole service80 ms3.0 sSomething is slow, not what
uri=/orders/{id}45 ms120 msHealthy, high volume
uri=/search640 ms2.8 sThe slow endpoint
instance=pod-7210 ms3.4 sOne bad instance
status=50430 s30 sTimeouts, counted separately
Breakdowns turn one misleading number into a few clear ones.

4Are Timed-Out Requests Counted at All?

A server-side timer records a request when the response is completed. Requests that never complete inside the service, or whose clients gave up first, can be missing or counted differently. If the load balancer times out after 10 seconds and closes the connection, the user saw a failure, but the service may record the request later, as a success, when it eventually finishes, or record it with an odd status. Requests rejected before they reach the application, because the connection queue was full, never appear in the service's metrics at all.

So we look at several signals: the count of 5xx and timeout statuses, the long task timer or active request count if available, and the request rate at the gateway compared with the rate the service records. A gap between those two rates is requests the dashboard never saw.

5Comparing With Gateway and Client Measurements

The service's timer starts when Spring's observation filter sees the request and stops when the response is written. It does not include DNS lookup, TLS handshakes, network transfer, waiting in the load balancer, or waiting in Tomcat's queue for a free thread. Under load, that queueing time can be hundreds of milliseconds while the server-side timer still says 50 ms, because the clock only starts once a thread picks the request up.

So we add latency as measured at the API gateway or load balancer, and if available real user monitoring from browsers or mobile apps. When the gateway's p99 is 1.5 s and the service's p99 is 300 ms, the missing time is in the network, the proxy or a queue in front of the service, and we know where to look next, for example at thread pool saturation.

Step throughWhere the time goes for one request
  1. Client and networkDNS, TLS, transfer: not in service metrics
  2. Gateway and load balancerQueueing and routing: in gateway metrics
  3. Tomcat accept queueWaiting for a free thread: not in the timer
  4. Spring observation startshttp.server.requests begins here
  5. Controller, database, downstream callsMeasured by the service
  6. Response writtenTimer stops

6 steps in order. Play them, or step through them one at a time.

The service's timer covers only the steps from the observation start.

6Follow-up questions

Why not just show the maximum instead of the average?

The maximum is one request, often an outlier like a first request after deployment, so it jumps around and does not tell us how many users are affected. Percentiles are more stable and answer the useful question: how slow is the slowest one or five percent.

Is p99 enough, or do we need p99.9?

For high-volume services that users call many times per session, p99.9 can matter, because one page load may make dozens of calls. It needs enough traffic to be meaningful; with 10 requests per second, p99.9 over five minutes is based on only three requests, so it is noisy.

Which number should the SLO use?

Usually a threshold-based indicator, such as the share of requests faster than 400 ms, rather than a percentile directly. It is easy to compute from histogram buckets, adds up correctly across instances and maps naturally to an error budget.

7Conclusion

In this answer, we saw why an 80 ms average can hide a slow service: the mean is pulled toward the many fast requests and barely moves for the slow tail, which users hit often because each page makes many calls. We added p95 and p99 from histograms and looked at the distribution, broke latency down by endpoint, status and instance, checked whether timed-out and rejected requests are counted, and compared with gateway or client measurements, which include network and queueing time that the service's own timer never sees.

What to say in the interviewAbout 80 seconds aloud

Open with

The average is hiding the tail. If ninety-nine requests take fifty milliseconds and one takes three seconds, the mean is still about eighty, but p99 is three seconds, and a user whose page makes twenty calls hits a slow one on almost one page in five.

Then, if they want more

So first I'd add p95 and p99, from a percentile histogram so they're correct across instances, and maybe a heat map to see the distribution. Second, I'd break latency down by endpoint, status and instance.

A fast, busy endpoint can hide a slow search endpoint, errors can be very fast or very slow, and one bad pod out of twenty is five percent of traffic, enough to ruin p99 while the average barely moves. Third, I'd check whether timed-out requests are counted at all.

If the load balancer gives up after ten seconds, the user saw a failure but the service may record it later or not at all, and requests rejected before reaching the application never show up, so I'd compare the gateway's request rate with the service's.

Finally, I'd compare with gateway or client-side latency, because the service's timer doesn't include network, the load balancer or waiting in Tomcat's queue for a thread, which under load can be the real problem.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "A latency dashboard shows the average response time is 80 ms, yet users complain the...": https://scrivio-interview-library.netlify.app/spring-boot/observability/3e89958c6f/