Load test an HTTP API with k6

8 steps · about 1 h 24 min · Intermediate

  1. Write and run your first k6 test script (reference, Grafana Labs, 10 min)

    Gets a working load script against an endpoint quickly.

  2. Choose between smoke, load, stress, spike and soak tests (guide, Grafana Labs, 10 min)

    Matches the test shape to the question you are asking.

  3. Plan an API load test from goals to workload (guide, Grafana Labs, 20 min)

    Walks through realistic API workload modelling.

  4. Assert response correctness with checks (reference, Grafana Labs, 6 min)

    Ensures fast responses are also correct responses.

  5. Fail the run on latency and error thresholds (reference, Grafana Labs, 8 min)

    Turns a load test into a pass/fail gate for CI.

  6. Model arrival rates and user ramps with scenarios (reference, Grafana Labs, 12 min)

    Controls how traffic grows so results reflect real use.

  7. Read the end-of-test summary percentiles (reference, Grafana Labs, 8 min)

    Explains p95, iteration and error metrics in the output.

  8. Compare with a Python-scripted load test in Locust (reference, Locust, 10 min)

    Shows an alternative tool when your team writes Python.