Medium java backend

Set a baseline (k6, JMeter or Locust; p50, p95, p99 and throughput)

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.

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)
  1. k6 thresholds
  2. Apache JMeter user manual
  3. Locust docs
  4. Google SRE book, Service Level Objectives
  5. Gil Tene, "How NOT to Measure Latency"