The 30 second answer
Before changing anything, I run a load test with a tool like k6, JMeter or Locust and record p50, p95, p99 and throughput at a known request rate. Averages hide the slow tail that real users feel, so percentiles are the baseline. Every later optimization is compared against this same test, so I can prove the change actually helped and did not just move the problem.
Could you say this in an interview?
Load-test tools replay traffic and report percentiles. An average hides the tail: a few very slow requests barely move the mean, but those users feel it. The Google SRE book recommends percentiles because latency distributions are skewed.
// k6: fail the test if p95 > 300 ms or p99 > 600 ms
export const options = { thresholds: { http_req_duration: ['p(95)<300', 'p(99)<600'] } };
Sources (5)
- k6 thresholdsgrafana.com
- Apache JMeter user manualjmeter.apache.org
- Locust docsdocs.locust.io
- Google SRE book, Service Level Objectivessre.google
- Gil Tene, "How NOT to Measure Latency"infoq.com