Latency is fine on average but p99 is terrible. Where do you look?
AdvancedScenarioScaling and performance
Answer
Situation read → Averages hide tails. A bad p99 means a minority of requests hit something slow: a specific path, a noisy pod, GC, throttling, or a cold cache.
What I'd do →
- Break p99 down by route, pod and node:
histogram_quantile(0.99, sum by (le, pod) (rate(http_request_duration_seconds_bucket{service="api"}[5m])))
- If one pod or node is the outlier: noisy neighbour, a node with high steal time, or a pod on a bad AZ path. Cordon and drain to test.
- If spread evenly: check CPU throttling (
container_cpu_cfs_throttled_periods_total), GC pauses, connection pool waits, and retries to slow dependencies. - Pull the slowest traces in Tempo or Jaeger and see which span dominates.
- Check fan-out: a request that calls 10 services is as slow as the slowest one, so tail latency compounds.
Why → CPU limits cause throttling within 100ms CFS periods, which shows up almost entirely in the tail.
Interview tip → Mention CFS throttling; many teams remove CPU limits (keeping requests) for latency-sensitive services because of it.
More on Scaling and performance
Traffic is expected to 10x for a sale next week. How do you prepare the platform?IntermediateThe HPA is configured but pods don't scale even though the app is slow. Why?BeginnerPods are Pending during a traffic spike because the cluster is out of capacity. What do you do now and long term?IntermediateThe database CPU is at 95% and the API is timing out. What's your approach?Intermediate"Too many connections" errors from Postgres after scaling the app out. How do you fix it?IntermediateOne pod in a deployment is much slower than the others. How do you investigate?Beginner