Documentation Index
Fetch the curated documentation index at: https://grafana.com/llms.txt
Fetch the complete documentation index at: https://grafana.com/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: https://grafana.com/docs/k6/next/examples/instant-load-increase.md (append .md) or send Accept: text/markdown to https://grafana.com/docs/k6/next/examples/instant-load-increase/. For the curated documentation index, use https://grafana.com/llms.txt. For the complete documentation index, use https://grafana.com/llms-full.txt.
This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
Instant load increase
One of the common usages of performance testing tools it’s the so-called stepped arrival rate.
In k6, you can do that by using the options object, and configuring the number of iterations or VUs in different scenarios.
Here’s an example on how to instantly increase the number of iterations and hold them for a period of time.
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
scenarios: {
contacts: {
executor: 'ramping-arrival-rate',
preAllocatedVUs: 50,
timeUnit: '1s',
startRate: 50,
stages: [
{ target: 200, duration: '30s' }, // linearly go from 50 iters/s to 200 iters/s for 30s
{ target: 500, duration: '0' }, // instantly jump to 500 iters/s
{ target: 500, duration: '10m' }, // continue with 500 iters/s for 10 minutes
],
},
},
};
export default function () {
http.get('https://test.k6.io');
sleep(1);
}Here’s an example on how to instantly increase the number of VUs and hold them for a period of time.
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
scenarios: {
contacts: {
executor: 'ramping-vus',
startVUs: 3,
stages: [
{ target: 20, duration: '30s' }, // linearly go from 3 VUs to 20 VUs for 30s
{ target: 100, duration: '0' }, // instantly jump to 100 VUs
{ target: 100, duration: '10m' }, // continue with 100 VUs for 10 minutes
],
},
},
};
export default function () {
http.get('https://test.k6.io');
sleep(1);
}Was this page helpful?
Related resources from Grafana Labs

