1. Why load test? #
Finding the limits before users do.
The questions a test answers #
Available in: ✓ OSS ✓ Enterprise ✓ Cloud k6 open source; managed runs with Grafana Cloud k6
- Does the service handle the expected traffic with the promised latency (SLO)?
- Where is the breaking point, and how does the service break (slowly, abruptly)?
- Is a new version slower than the previous one?
- Does autoscaling react fast enough?
Good to know: A load test is only valuable if it is observed: metrics, traces and profiles of the system under test explain what the test measures. That is why this course connects k6 to Prometheus and Grafana.
2. Types of tests #
One script base, several load profiles.
Overview #
| Type | Goal | Typical duration |
|---|---|---|
| Smoke | Check that the script and the service work (1 to 5 users) | 1 min |
| Average load | Validate behavior under normal traffic | 15 to 60 min |
| Stress | Observe behavior beyond normal traffic | 15 to 60 min |
| Spike | Absorb a sudden surge (sales, announcement) | A few minutes |
| Soak | Detect memory leaks and slow degradations | Several hours |
| Breakpoint | Find the maximum capacity | Until it breaks |
3. Why k6? #
A tool designed for developers.
Strengths #
| Feature | Detail |
|---|---|
| Scripts in JavaScript / TypeScript | Versioned with the code, reviewed in pull requests |
| Go engine | Thousands of virtual users on a single machine |
| Thresholds | The test fails automatically if an objective is not met: ideal in CI |
| Multiple outputs | Prometheus, OpenTelemetry, JSON, CSV, Grafana Cloud |
| Protocols | HTTP, WebSocket, gRPC, real browser (browser module) and extensions (Kafka, SQL...) |
# Installation
brew install k6 # macOS
sudo apt install k6 # Debian/Ubuntu (dépôt k6)
docker run --rm -i grafana/k6 run - < script.js # sans installationGood to know: k6 is open source (AGPLv3), maintained by Grafana Labs. Version 1.0, released in 2025, stabilized the API and brought native TypeScript support.
