No results for

Powered byAlgolia

Shared iterations

suggest edits

Description

A fixed number of iterations are "shared" between a number of VUs, and the test ends once all iterations are executed. This executor is equivalent to the global vus and iterations shortcut options.

Note that iterations aren't fairly distributed with this executor, and a VU that executes faster will complete more iterations than others. If you want guarantees that every VU will complete a specific, fixed number of iterations, use the per-VU iterations executor.

Options

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

OptionTypeDescriptionDefault
vusintegerNumber of VUs to run concurrently.1
iterationsintegerTotal number of script iterations to execute across all VUs.1
maxDurationstringMaximum scenario duration before it's forcibly stopped (excluding gracefulStop)."10m"

When to use

This executor is suitable when you want a specific amount of VUs to complete a fixed number of total iterations, and the amount of iterations per VU is not important.

Example

In this example, we'll execute 200 total iterations shared by 10 VUs with a maximum duration of 10 seconds

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