A dashboard shows a JVM service's p99 latency doubled overnight; what do you verify about the measurement itself before investigating the JVM?
answer
- distrust the number first
- same percentile, same source
- where the timer starts and stops
- throughput and request mix
- one instance or the whole fleet
basics
~20 sConfirm the regression is real before blaming the JVM: the same percentile from the same metric and histogram, enough requests behind it, the same traffic mix and load, and whether it shows on every instance or only some.
solid answer
~40 sI first check that the number means what it meant yesterday: the same percentile of the same metric, timed at the same place (load balancer, server filter, client), from a histogram whose buckets or labels the release did not change. Then I check what it was computed over: how many requests were in the window, the endpoint and payload mix, and throughput, because a traffic spike or a new heavy endpoint moves a p99 without any code regressing. Finally I break it down by instance, node pool, route and dependency: a regression on two nodes points somewhere very different from a fleet-wide one. Only when the shift survives all that, at the same load and mix, do I treat it as a JVM question.
go deeper
Recall that a percentile is computed from samples, so it depends on where they are timed and which requests are in the window. Say you would check the number before the system.
Explain the concrete checks: same metric and percentile, same timer location, unchanged buckets, request count, throughput and mix, then the per-instance and per-route breakdown and what each concentration points to.
Show the habit of ruling out artefacts and load before forming a JVM hypothesis, and of using the shape (p50 flat, errors flat, two nodes only) to pick the next step.
Talk about making this check cheap by default: consistent timers at known layers, stable bucket layouts, and per-instance, per-route and per-dependency labels so the breakdown exists before an incident.
## Why the measurement comes first A latency regression is a claim about a number, and a number can move for reasons that have nothing to do with the JVM. Before anyone opens a garbage-collection log, the first job is to confirm that the **percentile you are looking at means what it meant yesterday**, and that the requests behind it were the same kind of requests under the same load. An afternoon spent tuning a collector for a regression that was really a new dashboard query is a common wasted afternoon in production triage. A **percentile** such as p99 is the latency that 99% of requests in a window were faster than. It is computed from many samples, so it depends on where each sample was timed, how the samples were grouped, and which requests were in the window. ## What to check about the number - **Which percentile, from which metric.** Is the panel still showing p99 of the same metric, or did someone switch it to a different series, a different aggregation, or a different window? - **Where the timer starts and stops.** A timer in a load balancer includes network and queueing time; a timer in a servlet filter or a Netty handler starts only once a request thread picked the request up. Compare like with like. - **Did the release touch the instrumentation?** A new metrics library version, new **histogram bucket boundaries**, a renamed label or a timer moved to a different layer can shift the reported p99 although no request got slower. How bucket boundaries change an estimated percentile is covered with histogram percentiles; here it is enough to ask whether they changed. - **How many samples sit behind it.** A p99 over a window with a few hundred requests rests on a handful of slow ones, and it jumps around. Check request counts before trusting a doubling. ## What to check about the load - **Throughput.** More requests per second can push a service into queueing on a thread pool, a JDBC connection pool or a CPU limit, which stretches the tail first. That is a real regression, but its cause is load, not the release. - **Traffic mix.** A new heavy endpoint, a bigger average payload, a batch client that started that day, or a cold cache after a deploy all change what the p99 is made of. - **Time window.** Compare the same hours: a nightly batch job or a daily peak can sit inside one window and not the other. ## Break it down before you explain it A single fleet-wide p99 hides where the slowness is. Split it along every dimension you have. | Breakdown | If the regression is concentrated… | …it points to | |---|---|---| | Per instance or pod | on a few instances | something node-local: CPU contention, throttling, a bad host | | Per node or node pool | on one pool | the platform: hardware, kernel, CPU limits, neighbours | | Per route or operation | on one route | a code path or a dependency that route calls | | Per downstream dependency | on one client call | a slower downstream or its connection pool | | Per JVM build or release | on the new build only | the code, its dependencies or its JDK | Also look at the **neighbouring signals**: p50, error rate, throughput and CPU. A p99 that doubles while p50 and errors stay flat says a minority of requests pay the extra time, which already narrows the search to intermittent causes such as pauses, queueing at peaks, or one slow path. ## When the regression is real Once the shift survives these checks, it becomes a JVM and system question, and the playbook moves on: 1. Write down the confirmed symptom precisely: which percentile, which routes, which instances, since when, at what load. 2. List what changed at that time: code, dependencies, the base image and its JDK, flags, CPU and memory settings, the nodes underneath. 3. Split the extra tail time into JVM stops, on-CPU work, off-CPU waiting and downstream calls, using the evidence that is already recorded before adding new instruments. The order matters because each step is cheaper than the next and each can end the investigation: a metric artefact needs no profiler, and a traffic change needs no flag.
- Why does p50 staying flat while p99 doubles narrow the search?It says most requests are unaffected, so the cause hits a minority of them: something intermittent such as a pause that stalls whatever is in flight, queueing behind a saturated resource at peaks, one slow dependency or code path used by some requests, or one bad instance. A uniform slowdown, such as more work on every request, would usually move the median too.
- The server-side timer shows no change but the client-side p99 doubled. What does that tell you?The extra time is outside the code the server's timer wraps: the network, a load balancer, the accept queue, or waiting for a free request thread before the timer starts, or the client's own connection pool. Compare exactly where each timer starts and stops, then look at the layer between them rather than inside the handler.
- Jumps straight to GC flags because the p99 moved.
- Compares this week's p99 with last week's at a different traffic level.
- Treats a p99 from a few hundred requests as a precise figure.
- Assumes the release could not have changed the latency instrumentation.
- Looks only at the fleet-wide number, never per instance or route.