Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 36 · Getting Started

Reading the End-of-Test Summary

Learn to read the k6 end-of-test summary: http_req_duration, percentiles, http_req_failed, iterations, vus, data sent and received, plus how percentiles are computed.

When a k6 run finishes it prints a summary: a table of every metric with a handful of statistics each. Beginners often look only at the average response time, which is the least useful number in the table. This lesson explains each line of the summary, why percentiles matter far more than averages, and shows you how to compute them yourself.

An annotated summary

Here is a shortened summary from a small test. The values are illustrative, not from a real server.

TEXT
     checks.........................: 100.00% 40 out of 40
     data_received..................: 12 kB   1.2 kB/s
     data_sent......................: 3.2 kB  320 B/s
     http_req_blocked...............: avg=1.1ms  min=2µs   med=5µs   max=12ms  p(90)=8µs   p(95)=9ms
     http_req_connecting............: avg=0.4ms  min=0s    med=0s    max=4ms   p(90)=0s    p(95)=3ms
     http_req_duration..............: avg=86ms   min=71ms  med=82ms  max=190ms p(90)=104ms p(95)=121ms
       { expected_response:true }...: avg=86ms   min=71ms  med=82ms  max=190ms p(90)=104ms p(95)=121ms
     http_req_failed................: 0.00%   0 out of 40
     http_req_receiving.............: avg=0.1ms  min=20µs  med=0.1ms max=1ms   p(90)=0.2ms p(95)=0.3ms
     http_req_sending...............: avg=30µs   min=10µs  med=28µs  max=90µs  p(90)=50µs  p(95)=60µs
     http_req_tls_handshaking.......: avg=0s     min=0s    med=0s    max=0s    p(90)=0s    p(95)=0s
     http_req_waiting...............: avg=85ms   min=70ms  med=82ms  max=189ms p(90)=103ms p(95)=120ms
     http_reqs......................: 40      4/s
     iteration_duration.............: avg=1.08s  min=1.07s med=1.08s max=1.19s  p(90)=1.1s  p(95)=1.12s
     iterations.....................: 40      4/s
     vus............................: 4       min=4  max=4
     vus_max........................: 4       min=4  max=4

The lines that matter most

http_req_duration is the total time of a request from the moment k6 starts sending until the response body is fully received. It equals http_req_sending + http_req_waiting + http_req_receiving. It deliberately excludes DNS lookup, TCP connect and TLS handshake, which are reported separately as http_req_blocked, http_req_connecting and http_req_tls_handshaking.

http_req_waiting is the time to first byte: how long the server thought about the request. When this is large, the backend is slow. When http_req_receiving is large, the response is big or the network is slow.

http_req_failed is the rate of failed requests. By default a request fails when the connection fails or the status is 4xx or 5xx (the default response callback considers 200 to 399 as success). It is the number to put a threshold on.

http_reqs is the total count of requests and the rate per second. iterations is the count of default-function runs and its rate; with one request per iteration the two are equal. iteration_duration includes sleep time, so it is always longer than the request.

vus and vus_max report the active and allocated virtual users. data_sent and data_received count bytes on the wire, useful for estimating bandwidth costs. checks is the pass rate of your check() calls, covered in the next chapter.

The statistics: avg, med, min, max, p(90), p(95)

  • avg is the arithmetic mean. One slow outlier pulls it up; many fast requests hide it.
  • med is the median: half of the requests were faster, half slower. It describes the typical request.
  • p(90) is the 90th percentile: 90% of requests were at least this fast, and 10% were slower. p(95) and p(99) show the tail.
  • min and max are the extremes. Max is noisy but reveals the worst case.

Why prefer percentiles? Imagine 100 requests: 99 take 100 ms and one takes 10 seconds. The average is 199 ms, which sounds fine, while one user in a hundred waited ten seconds. The p(99) tells the truth. Real traffic makes many calls per page, so a user will meet the slow tail more often than you think. That is why thresholds are usually written on p(95) or p(99).

Compute the same statistics yourself

The stand-in below is not k6, but its percentile function uses the same idea (sort the samples and pick one by rank). It builds a deliberately skewed sample and shows how the average hides the tail.

Node.js Stand-in: average versus percentiles

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

The median is 100 ms and the average is 208 ms, yet p(99) is 3 seconds. Two users out of a hundred had a terrible experience that the average smoothed over. (k6 interpolates a little differently from the nearest-rank method, so real k6 may print slightly different tail values for small samples.)

Tags and sub-metrics

The line { expected_response:true } is a sub-metric: the same metric restricted to requests with a given tag. The summary shows it so that failed requests, which are often very fast, do not drag your timing statistics down. You can create your own sub-metrics with thresholds on tags; you will see this in Thresholds and Groups and Tags.

Getting more than the summary

The built-in summary is only a digest. For analysis you want the raw data points:

Terminal
k6 run --out json=results.json script.js
k6 run --out csv=results.csv script.js
k6 run --summary-export=summary.json script.js

--out json writes one line per data point (every request, every metric), which can get huge. --summary-export writes just the final summary as JSON, which is perfect for a CI job. The Results and Metrics chapter of this track goes deeper into outputs, Grafana dashboards and custom summaries.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What does http_req_duration include?

    http_req_duration = sending + waiting + receiving. Connection setup is reported separately as http_req_blocked, connecting and tls_handshaking.
  2. 2. Why are percentiles more useful than the average for response times?

    A few slow requests barely move the average but show clearly in p(95) or p(99).
  3. 3. What does p(95)=121ms mean?

    The 95th percentile is the value that 95% of the samples do not exceed.
  4. 4. Which metric is the time to first byte (how long the server worked on the request)?

    http_req_waiting measures the time between the request being sent and the first response byte arriving.

Summary

  • The summary lists each metric with avg, min, med, max, p(90) and p(95).
  • http_req_duration is sending plus waiting plus receiving; http_req_waiting is time to first byte.
  • http_req_failed, checks and http_reqs tell you about errors and volume.
  • Prefer median and percentiles to the average; the tail is what users feel.
  • --out and --summary-export give you the raw data and a machine-readable summary.

Next: The Script Lifecycle