No results for

Powered byAlgolia

Ramping VUs

suggest edits

Description

A variable number of VUs execute as many iterations as possible for a specified amount of time. This executor is equivalent to the global stages option.

Options

In addition to the common configuration options this executor also adds the following options:

OptionTypeDescriptionDefault
stages*arrayArray of objects that specify the target number of VUs to ramp up or down to.[]
startVUsintegerNumber of VUs to run at test start.1
gracefulRampDownstringTime to wait for an already started iteration to finish before stopping it during a ramp down."30s"

When to use

This executor is a good fit if you need VUs to ramp up or down during specific periods of time.

Example

In this example, we'll run a two-stage test, ramping up from 0 to 100 VUs for 5 seconds, and down to 0 VUs over 5 seconds.

ramping-vus.js
1import http from 'k6/http';
3export let options = {
4 discardResponseBodies: true,
5 scenarios: {
6 contacts: {
7 executor: 'ramping-vus',
8 startVUs: 0,
9 stages: [
10 { duration: '5s', target: 100 },
11 { duration: '5s', target: 0 },
12 ],
13 gracefulRampDown: '0s',
14 },
15 },
16};
18export default function () {
19 http.get('https://test.k6.io/contacts.php');
20}

Note the setting of gracefulRampDown to 0 seconds, which could cause some iterations to be interrupted during the ramp down stage.