No results for

Powered byAlgolia

Externally controlled

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

The externally-controlled executor has no graceful stop.

Besides that, this executor has all the common configuration options, and these particular ones:

OptionTypeDescriptionDefault
duration(required)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.

Example

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

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