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.
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Performance testing best practices with k6
Checklist for useful load tests: objectives, realistic scenarios, environment, thresholds, observ...
Observing a k6 test: Prometheus, Grafana and correlation with the system under test
Send k6 results to Prometheus (remote write) or via OpenTelemetry, visualize them in Grafana and ...
Browser testing and synthetic monitoring with k6
Test a web application in a real browser with the k6 browser module, measure Core Web Vitals, and...
Thresholds, metrics and results of a k6 test
Read the summary of a k6 test, understand the built-in metrics (http_req_duration, http_req_faile...
End-to-end CI/CD (2/5): continuous integration, testing and quality
Succeed with continuous integration: the test pyramid, unit, integration, contract and end-to-end...
Website monitoring: availability, HTTPS monitoring, certificates and performance
Set up website monitoring: availability and HTTPS checks, certificate expiry, response time, Core...
k6 in continuous integration and on Kubernetes (k6-operator)
Automate performance tests: k6 in GitHub Actions and GitLab CI with blocking thresholds, distribu...
HAProxy in Kubernetes: the high-performance Ingress Controller
Discover in depth how HAProxy integrates with Kubernetes: direct-to-pod architecture, hot update ...
End-to-end CI/CD (4/5): deployment strategies and rollback
Deploy without downtime and without risk: recreate, rolling update, blue/green, canary, feature f...