Skip to main content
Grafana k6

Prevent performance issues with k6

Grafana k6 is an open-source, developer-friendly, and extensible load testing tool. k6 allows you to prevent performance issues and proactively improve reliability. Using k6, you can test the reliability and performance of your application and infrastructure. k6 helps engineering teams prevent errors and SLO breaches, enabling them to build resilient and high-performing applications that scale.

What is k6?

k6 is a CLI-based load testing tool written in Go with test scripts in JavaScript. It’s designed for developers, QA engineers, SDETs, and SREs who need to:
  • Simulate realistic user behavior
  • Identify performance bottlenecks before production
  • Validate system reliability under load
  • Integrate performance testing into CI/CD pipelines

Why k6?

Learn why k6 is the right choice for your load testing needs

Installation

Install k6 on Linux, macOS, Windows, or Docker

Write Your First Test

Create your first k6 test script in minutes

Understanding Results

Learn how to read and analyze k6 metrics

Key features

JavaScript Testing

Write tests in JavaScript with a familiar syntax. No need to learn a new language.

CLI-Based

Run tests from your terminal, CI/CD pipelines, or automation tools.

Developer-Friendly

Built for developers with auto-completion, TypeScript support, and version control integration.

High Performance

Generate massive load with minimal resources. Run thousands of virtual users on a single machine.

Extensible

Extend k6 with custom protocols using extensions or test browser performance with the browser module.

CI/CD Integration

Seamlessly integrate with Jenkins, GitHub Actions, GitLab CI, and other automation tools.

Common use cases

Engineering teams use k6 for:

Load and performance testing

k6 is optimized for minimal resource consumption and designed for running high-load performance tests such as spike, stress, or soak tests.

Browser performance testing

Through the k6 browser API, you can run browser-based performance tests and collect browser metrics to identify performance issues related to browsers.

Performance and synthetic monitoring

Schedule tests to run with minimal load very frequently, continuously validating the performance and availability of your production environment.

Automation of performance tests

k6 integrates seamlessly with CI/CD and automation tools, enabling engineering teams to automate performance testing as part of their development and release cycle.

Chaos and resilience testing

Use k6 to simulate traffic as part of your chaos experiments or inject different types of faults in Kubernetes with xk6-disruptor.

Infrastructure testing

With k6 extensions, you can add support for new protocols or use a particular client to directly test individual systems within your infrastructure.

Get started in minutes

1

Install k6

Install k6 using your package manager or Docker:
# macOS
brew install k6

# Linux
sudo apt-get install k6

# Docker
docker pull grafana/k6
2

Write a test script

Create a simple test file test.js:
import http from 'k6/http';
import { sleep } from 'k6';

export const options = {
  vus: 10,
  duration: '30s',
};

export default function () {
  http.get('https://test.k6.io');
  sleep(1);
}
3

Run your test

Execute the test from your terminal:
k6 run test.js
4

Analyze results

View the summary statistics in your terminal, including response times, throughput, and error rates.

Next steps

Get Started Guide

Follow our step-by-step guide to start testing

JavaScript API Reference

Explore the complete k6 API documentation

Testing Guides

Learn testing strategies and best practices

Example Scripts

Browse real-world k6 test examples

Build docs developers (and LLMs) love