Difference between revisions of "K6"
From Indie IT Wiki
Plittlefield (talk | contribs) |
Plittlefield (talk | contribs) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
== Introduction == | == 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. | + | [https://k6.io/ 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 == | == Installation == | ||
Line 13: | Line 13: | ||
https://grafana.com/docs/k6/latest | 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('<nowiki>https://test.k6.io</nowiki>'); | ||
+ | sleep(1); | ||
+ | } | ||
+ | |||
+ | Run it ... | ||
+ | |||
+ | k6 cloud run test.js | ||
+ | |||
+ | View the results in your Grafana Admin pages online ... | ||
+ | |||
+ | https://yourusername.grafana.net/a/k6-app |
Latest revision as of 16:25, 6 September 2024
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 ...