Skip to content
Commitwise
Menu

The p99 latency of an endpoint doubled after a release. How do you find out why?

BackendSenior

In shortConfirm and scope it with metrics, find where the time goes with distributed traces, correlate with the release diff and resource metrics (database, pools, GC, CPU), form a hypothesis, verify it with profiling or a targeted test, then fix and confirm with the same metric.

Model answer

1. Confirm and scope: dashboards for latency percentiles, error rate and throughput by endpoint, instance, version and region. Is it every instance with the new version (code), one instance (host), or all versions (a dependency or traffic change)? If it’s clearly the release and user-facing, roll back or disable the feature flag first, then investigate.

2. Find where the time goes: pick slow traces (exemplars from the p99 bucket) and look at the spans: database queries (count and duration), downstream HTTP calls, cache calls, time waiting for a connection from the pool. A trace with 120 small queries is an N+1; a long gap before the first query is often pool or thread starvation.

3. Correlate with resources: connection pool active/pending counts, database CPU and slow-query log, GC pause times and heap, CPU throttling in containers, thread pool saturation, cache hit rate.

4. Compare with the diff: new queries or eager associations, a removed index or cache, a new synchronous call, larger payloads, a library upgrade with different defaults.

5. Verify: reproduce with a load test or profile in a staging environment (async-profiler, JFR), or test the hypothesis with a flag. Fix one thing at a time.

6. Close the loop: confirm p99 recovered on the same dashboard, add an alert or a performance test for the path, and write a short post-incident note.

What they're looking for

A systematic method, the three pillars (metrics, traces, logs) used for what each is good at, common causes (N+1 queries, pool exhaustion, GC, lock contention, slow dependencies, cache misses), and safe mitigation (rollback, flags).

Common mistakes

  • Looking only at averages.
  • Guessing and changing several things at once.
  • Not checking whether the regression is in the service or a dependency.

More backend questions

Esc

Type to search the whole site.