No results for

Powered byAlgolia

Externally controlled

suggest edits

Description

Control and scale execution at runtime via k6's REST API or the CLI.

Previously, the pause, resume, and scale CLI commands were used to globally control k6 execution. This executor does the same job by providing a better API that can be used to control k6 execution at runtime.

Note that, passing arguments to the scale CLI command for changing the amount of active or maximum VUs will only affect the externally controlled executor.

Options

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

OptionTypeDescriptionDefault
duration*stringTotal test duration.-
vusintegerNumber of VUs to run concurrently.-
maxVUsintegerMaximum number of VUs to allow during the test run.-

When to use

If you want to control the number of VUs while the test is running.

Important: this is the only executor that is not supported in k6 cloud, it can only be used locally with k6 run.

Examples

In this example, we'll execute a test controllable at runtime, starting with 0 VUs up to a maximum of 50, and a total duration of 10 minutes.

externally-controlled.js
1import http from 'k6/http';
3export let options = {
4 discardResponseBodies: true,
5 scenarios: {
6 contacts: {
7 executor: 'externally-controlled',
8 vus: 0,
9 maxVUs: 50,
10 duration: '10m',
11 },
12 },
13};
15export default function () {
16 http.get('https://test.k6.io/contacts.php');
17}