K6
From Indie IT Wiki
Revision as of 16:24, 6 September 2024 by Plittlefield (talk | contribs)
Introduction
Grafana k6 is a developer-friendly and extensible load testing tool that helps prevent performance issues and improve reliability. Learn how to use k6 for load, browser, synthetic, and chaos testing, and integrate it with CI/CD and Grafana Cloud.
Installation
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69 echo "deb https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list sudo apt-get update sudo apt-get install k6
Documentation
https://grafana.com/docs/k6/latest
Usage
Create your javascript text file and save it as test.js ...
import http from 'k6/http'; import { sleep } from 'k6'; export const options = { vus: 10, duration: '30s', cloud: { // Project: Default project projectID: 3712985, // Test runs with the same name groups test runs together. name: 'Test (06/09/2024-14:52:36)' } }; export default function() { http.get('https://test.k6.io'); sleep(1); }
Run it ...
k6 cloud run test.js
View the results in your Grafana Admin pages online ...