K6
lastmod 2026-11-16created 2026-11-162 edits
k6 (Grafana k6) is an open-source load testing tool developed by Grafana Labs. The engine is written in Go, and test scenarios are written in JavaScript. Targets such as response times (SLOs) can be written into the script as thresholds, and the test passes or fails against them, which makes k6 a popular way to add performance checks to CI/CD pipelines.
About
- Scripts are ES modules. You import built-in modules such as
k6/httpand write the actions that each virtual user (VU) repeats insideexport default function. Run withk6 run script.js - Set the load with
vusanddurationinoptions, or usestagesto ramp the number of VUs up and down over time. Scenarios let you choose load shapes such as open/closed models, constant RPS, or a fixed number of iterations -
check()validates response status and body. Thresholds pair a metric with a percentile target, as inhttp_req_duration: ["p(99) < 3000"], and the test ends as failed if a target is not met - Test type guides in the official documentation: smoke, load, stress, spike, soak
- Supports HTTP, WebSockets, gRPC, and browser testing (k6 browser). Extensions such as xk6-kafka and xk6-kubernetes add protocols and features
- Results can be exported to Prometheus remote write, Datadog, New Relic, and others, and viewed in Grafana dashboards. The same script also runs on Grafana Cloud k6 or on Kubernetes (
kubectl apply) - A separate desktop app, k6 Studio, creates scripts without writing code by hand
- AGPL-3.0 license
See also
- Load testing
- Grafana
- Locust - load testing tool that defines user behavior in Python code
- Gatling - load testing tool written in Scala
Favorite site
- Load testing for engineering teams | Grafana k6
- Grafana k6 | Grafana k6 documentation
- Github - grafana/k6
Articles
- [K6] Things worth knowing before you start with K6 - Rocket🐾
- Running with
vus: 10, duration: "10s"means 10 virtual users call the default function repeatedly for 10 seconds, not once per user - Latency is the time from request to response, and throughput is the number of requests handled per unit of time. The article explains both with a restaurant-ordering analogy
- Test only apps you own, and in Dev or Staging environments rather than production. In the cloud, also check whether scale-up/scale-out happens during the test
- Averages hide slow requests. If 400 of 500 orders take 20 seconds and 100 take more than 10 minutes, the average still comes out at about 4 minutes
- That is why k6 results include p(90) and p(95). p(90) means 90% of requests finished within that time, which matches the form of SLO statements such as "90% of responses within 0.5 seconds"
- Running with
Pages that link here