PROVIDER - developer-friendly load testing

k6

k6 came from the k6 team and joined Grafana Labs in 2021, driving high concurrency from ES6 scripts in a single Go binary while checks and thresholds push performance assertions into CI; browser-level testing, distributed cost and protocol coverage are its limits.

Developer Tools Sweden 2026.11.19
4pts

Detailed Notes

Pros 5 items

Built by the k6 team and acquired by Grafana Labs in 2021, scripting in ECMAScript 6 syntax
A single Go binary runs without a JVM or browser, driving more than 10,000 virtual users from 1 machine
Ships 2 assertion layers, checks and thresholds, so performance regressions can fail CI directly
Scenario orchestration supports more than 5 executors including constant-vus and ramping-vus
Connects with 3 observability back ends - Grafana Cloud, Prometheus and OpenTelemetry - for live metric visualisation

Cons 4 items

No browser-level rendering load by default, since end-to-end scenarios rely on the limited k6 browser module
Distributed load testing needs self-hosting or Grafana Cloud k6, with cost rising alongside concurrency
Scripting requires JavaScript basics, which is slower for non-developers than record-and-playback tools
Protocol coverage centres on HTTP, gRPC and WebSocket, so niche protocols need extensions

Service Overview

k6 is an open source load testing tool scripted in ECMAScript 6, acquired by Grafana Labs in 2021 and integrated with the Grafana observability stack. It runs as a single Go binary with no JVM or browser dependency.

In the development tools category it represents load testing as code: scripts and thresholds live in the repository, so performance regressions surface during CI.

Key Strengths

  • Minimal deployment: one binary means almost no environment setup
  • Expressive scripting: ES6 lets you reuse functions and modules beyond recorded flows
  • Assertions in CI: 2 layers, checks and thresholds, can fail the pipeline outright
  • Rich executors: more than 5 scenario styles including constant-vus and ramping-vus
  • Observability integration: metrics flow to Grafana Cloud, Prometheus and OpenTelemetry

Product Ecosystem

Tooling and runtime

The k6 CLI in Go, the xk6 extension mechanism and the k6 browser module.

Managed service

Grafana Cloud k6 provides distributed runs, result analysis and historical comparison.

Typical scenarios

API load tests, capacity planning, pre-rollout baselines and CI performance gates.

Limitations

  • Browser capability: end-to-end rendering tests rely on k6 browser with narrower coverage
  • Distributed cost: high concurrency depends on the cloud service, billed by virtual users
  • Scripting barrier: JavaScript basics are required, unlike record-and-playback tools
  • Protocol range: HTTP, gRPC and WebSocket dominate, with others needing extensions

Use Cases

  • API and microservice load testing (★★★★★): scripted scenarios and assertions compose flexibly
  • CI performance gates (★★★★★): threshold failures block merges
  • Capacity planning and reporting (★★★★): Grafana dashboards simplify communication
  • Browser end-to-end performance (★★★): assess k6 browser coverage first

Pricing

Item Price Notes
k6 open source $0 Open source under AGPL 3.0
Grafana Cloud k6 free tier $0 Limited virtual user hours
Grafana Cloud k6 paid Usage based Billed by virtual user hours and retention

Local and small-scale tests are free, while distributed runs and long retention need a cloud subscription.

FAQ

  • k6 or JMeter? Choose k6 when the team is code- and CI-oriented; pick JMeter for graphical orchestration and a wide protocol plugin set.
  • Does it test WebSockets? Yes, with a built-in WebSocket API, though long-lived connections need manual message pacing.
  • How is distributed load generated? Either the k6 operator on Kubernetes or Grafana Cloud k6.

Code Examples

A basic load test script

import http from 'k6/http';
import { check, sleep } from 'k6';

export const options = {
  vus: 20,
  duration: '30s',
  thresholds: {
    http_req_duration: ['p(95)<500'],
    http_req_failed: ['rate<0.01'],
  },
};

export default function () {
  const res = http.get('https://quickpizza.grafana.com/');
  check(res, { 'status is 200': (r) => r.status === 200 });
  sleep(1);
}

options declares virtual users and thresholds, check records assertions, and thresholds decide whether the pipeline fails.

A ramp-up scenario

export const options = {
  scenarios: {
    ramp: {
      executor: 'ramping-vus',
      startVUs: 0,
      stages: [
        { duration: '1m', target: 50 },
        { duration: '2m', target: 50 },
        { duration: '1m', target: 0 },
      ],
    },
  },
};

ramping-vus uses stages to describe ramp-up, steady state and ramp-down, closer to real traffic shapes.

Community & Resources

Visit k6 Website → https://k6.io/
Visit Website ↗