QA Interview Hub · Knowledge base · Quizzes · Українська

Performance Testing

Metrics

Key metrics: response time, throughput, percentiles

The key metrics are response time, throughput (requests per second), error rate and resource usage, and they must be read together. The average hides rare slow requests, so goals are written as percentiles such as p95 and p99. Percentiles of different instances are not averaged; raw data or histograms are used instead. When throughput flattens while response time keeps growing, the system has reached saturation.

Performance · Metrics

The report says average 203 ms, yet users complain about freezes. What is wrong with the number?

A load test report: average response time 203 ms, no errors, the goal "within 500 ms" is met. Yet support gets complaints that the page sometimes takes several seconds. The average does not lie, it answers a different question: it folds all requests into one number, and rare very slow responses drown among fast ones. This lesson is about which metrics to read together, why goals are written in percentiles, and how to tell an overloaded system from a healthy one.

How it works and why. The main metrics in a report:

  • Response time: the time from sending a request to receiving the response. Latency usually means the delay before the response starts (network, waiting); tools use the terms differently, so check what exactly a metric measures;
  • Throughput: how many requests or transactions the system handles per unit of time (RPS, TPS);
  • Error rate: the share of requests with an error (5xx, timeouts). A fast error is also a "fast response", so time without error rate proves nothing;
  • Concurrent users / VU: how many virtual users are active at once. This is not RPS: one user with pauses between actions makes few requests;
  • Resources: CPU, memory, disk, network, database connections.

The metrics are linked. For a system where users wait for a response and then pause (think time), Little's law gives RPS ≈ VU / (response time + think time). So the number of users alone says nothing about load: 200 VU can produce 20 or 400 RPS depending on the pauses.

VUResponse timeThink timeThroughput
2000.5 s9.5 s≈ 20 RPS
2000.5 s0 s≈ 400 RPS
2002 s (server slowed down)9.5 s≈ 17 RPS

The "load versus response" curve has a typical shape: while resources suffice, throughput grows in proportion to the load and response time barely changes. After the saturation point (one resource runs out), throughput stops growing, requests queue up, and response time climbs steeply. So the pair "throughput flattened while time grows" is a saturation signal, not "one more fluctuation".

Throughput and response time as load grows

saturationthroughputlatencyoffered load (RPS)
Figure 1. Up to the saturation point the system scales with the load. After it, throughput stands still and response time rises sharply.

Why percentiles. The response time distribution almost always has a long right tail. p95 is the value that 95 % of requests do not exceed; p99 is the same for 99 %. So goals are written as "p95 < 500 ms", and the average stays a reference number. There are two more reasons to look at the tail. First, a page user feels the slowest of the dozens of requests a page makes: if 3 % of requests are slow and a page makes 20 requests, at least one slow request shows up in 1 − 0.9720 ≈ 46 % of page loads. Second, percentiles of different instances are not averaged: the mean of two p95 values is not the p95 of the combined data. You need raw measurements or histograms that can be merged.

Example: a green goal and a bad tail. A hypothetical distribution of 10,000 requests (the numbers are illustrative): 9,700 between 100 and 200 ms, 250 around 700 ms, 50 around 8 s.

MetricValueWhat it shows
Average≈ 203 msLooks great but hides the tail
p50 (median)≈ 150 msA typical request is fast
p95≈ 190 msThe goal "p95 < 500 ms" is met
p99≈ 700 msEvery hundredth request is already over four times the median
p99.9≈ 8 sThe freeze complaints are explained

The p95 goal passed, yet the complaints are real: the last percent of requests suffers, and it is visible only in p99 and p99.9. The fix is not to "improve the average" but to add p99 to the goals and investigate the cause of the tail (garbage collection, locks, cold caches, a slow database query, retries). A k6 setup that shows these statistics and sets thresholds on them:

export const options = {
  // which statistics to show in the summary
  summaryTrendStats: ['avg', 'med', 'p(95)', 'p(99)', 'p(99.9)', 'max'],
  thresholds: {
    http_req_failed: ['rate<0.01'], // fewer than 1 % errors
    http_req_duration: ['p(95)<500', 'p(99)<1500'],
  },
};

Two versions of a report for the same test

Typical

The average only

Average time 203 ms, "within the goal". The tail and the errors are invisible, and the conclusion "all is well" is wrong.

Better

Percentiles, throughput and errors

p50, p95, p99, max, RPS and error rate together. It shows that the tail suffers and where throughput stops growing.

Figure 2. A report without percentiles and error rate does not prove the system is healthy.

Limits and alternatives. A percentile is accurate only with enough measurements: p99.9 over 500 requests means nothing. An overall p95 over a mixed stream of operations can hide a slow operation: set goals per key operation. Apdex reduces response time to a satisfaction score from 0 to 1: requests up to a threshold T are "satisfied", up to 4T "tolerating", the rest "frustrated", and the index is (satisfied + tolerating / 2) / all. It is handy for a dashboard but hides the distribution, so diagnosis looks at percentiles. One risk percentiles do not reveal on their own: if the generator waits for a response before sending the next request, slow responses are under-measured (coordinated omission, see the planning lesson).

Typical mistakes.

  • A goal or conclusion based on the average response time.
  • Averaging p95 across instances or runs instead of merging the raw data.
  • Response time without error rate: fast 500s make a report "better".
  • Mixing up VU and RPS: "200 users" says nothing about intensity without think time.
  • p99 or p99.9 on a small sample.
  • Ignoring that "latency" differs between tools: different metrics get compared.

Check yourself

Two instances: the first handled 9,000 requests with p95 100 ms, the second 1,000 with p95 900 ms. Is the p95 of the combined sample 500 ms?

Answer

No. The mean of two p95 values is not a percentile of the merged data. The overall p95 is computed from raw measurements or merged histograms of both instances, and it depends on the distributions, not on the half-sum.

Throughput flattened at 120 RPS while the offered load keeps growing and response time shoots up. What does it mean?

Answer

The system reached saturation: one resource is exhausted, the excess requests queue up, so time grows while throughput does not. Next you look for the resource: CPU, connection pool, database.

A page makes 20 requests and 3 % of requests are slow. How many page loads feel a slow request?

Answer

About 46 %: 1 − 0.97 to the power of 20. So the tail matters more than the percentage of a single request suggests.

In an interview. Junior: Response time is the time from a request to its response, throughput is requests per second, error rate is the share of errors. The average hides slow requests, so we look at percentiles such as p95 and p99. Middle/Senior: I set goals on the percentiles of key operations together with error rate, not on the average. I read "throughput flattened while time grows" as saturation. I do not average percentiles across instances but take raw data or histograms, and I do not confuse VU with RPS, because intensity depends on think time.