Grafana k6 Load testing
Daniel Nashed – 15 December 2025 23:42:05
For simple load-testing I have been using Apache ab.
https://httpd.apache.org/docs/2.4/programs/ab.html
Apache ab quite OK for basic testing and very simple to use.
But for more advanced testing there are more modern frameworks like Grafana k6.
I gave it a quick try today and it looks like a great tool.
It can also write to Prometheus and use Grafana to display results.
Most of the Grafana Dashboards use InfuxDB but the more straightforward way would be to write to Prometheus.
But even without visualization the results are very useful.
I first tried to install it on Ubuntu. But it isn't included in the distribution and needs to add separate repositories.
With a container it is pretty simple to use. For the results you can just run Prometheus and Grafana in a local docker-compose stack.
I think this looks like a new interesting project for adding load testing to the container automation testing.
Is anyone using Grafana k6 already? Do you use Grafana Dashboard integration? Are you writing into Prometheus or InfluxDB?
What type of load testing are you running?
Run via Docker
docker run --rm --network host -i -v $(pwd):/k6 -e "K6_PROMETHEUS_RW_SERVER_URL=http://127.0.0.1:9090/api/v1/write" grafana/k6 run /k6/login.js --summary-export=/k6/summary.json --out experimental-prometheus-rw
The command writes a log file, a summary and writes into Prometheus.
Simple load test example:
Here is a very simple script with a login and some requests dumping cookies and result headers.
import http from 'k6/http';
export const options = {
vus: 10,
iterations: 1000,
};
export default function () {
if (__ITER === 0) {
http.post(
'https://domsetup.notes.lab/names.nsf?Login',
{
username: 'user',
password: 'password',
}
);
console.log(`Login Request (VU=${__VU}, ITER=${__ITER})`);
const jar = http.cookieJar();
const cookies = jar.cookiesForURL('https://domsetup.notes.lab');
const res = http.get('https://domsetup.notes.lab/homepage.nsf');
console.log(`VU=${__VU} ITER=${__ITER} Status=${res.status}`);
console.log('Cookies: ' + JSON.stringify(cookies, null, 2));
console.log('Headers: ' + JSON.stringify(res.headers, null, 2));
}
http.get('https://domsetup.notes.lab/homepage.nsf');
}
- Comments [0]