Skip to content

Commit d35ec85

Browse files
authored
Minor changes on constant-arrival-rate docs (#1487)
* Minor changes on constant-arrival-rate docs * Adjust constant-arrival-rate example and notes
1 parent 34349f9 commit d35ec85

File tree

4 files changed

+39
-23
lines changed

4 files changed

+39
-23
lines changed

docs/sources/next/using-k6/scenarios/executors/constant-arrival-rate.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Besides the [common configuration options](https://grafana.com/docs/k6/<K6_VERSI
2929
this executor has the following options:
3030

3131
| Option | Type | Description | Default |
32-
| ------------------------------------ | ------- | ------------------------------------------------------------------------------ | ----------------------------------- |
32+
|--------------------------------------|---------|--------------------------------------------------------------------------------|-------------------------------------|
3333
| duration<sup>(required)</sup> | string | Total scenario duration (excluding `gracefulStop`). | - |
3434
| rate<sup>(required)</sup> | integer | Number of iterations to start during each `timeUnit` period. | - |
3535
| preAllocatedVUs<sup>(required)</sup> | integer | Number of VUs to pre-allocate before test start to preserve runtime resources. | - |
@@ -53,7 +53,7 @@ So it's unnecessary to use a `sleep()` function at the end of the VU code.
5353
## Example
5454

5555
This example schedules a constant rate of 30 iterations per second for 30 seconds.
56-
It allocates 50 VUs for k6 to dynamically use as needed.
56+
It pre-allocates 2 VUs, and allows k6 to dynamically schedule up to 50 VUs as needed.
5757

5858
{{< code >}}
5959

@@ -75,8 +75,12 @@ export const options = {
7575
// Start `rate` iterations per second
7676
timeUnit: '1s',
7777

78-
// Pre-allocate VUs
79-
preAllocatedVUs: 50,
78+
// Pre-allocate 2 VUs before starting the test
79+
preAllocatedVUs: 2,
80+
81+
// Spin up a maximum of 50 VUs to sustain the defined
82+
// constant arrival rate.
83+
maxVUs: 50,
8084
},
8185
},
8286
};
@@ -98,7 +102,7 @@ Based upon our test scenario inputs and results:
98102

99103
- The desired rate of 30 iterations started every 1 second is achieved and maintained for the majority of the test.
100104
- The test scenario runs for the specified 30 second duration.
101-
- Having started with 2 VUs (as specified by the `preAllocatedVUs` option), k6 automatically adjusts the number of VUs to achieve the desired rate, up to the allocated number. For this test, this ended up as 17 VUs.
102-
- Exactly 900 iterations are started in total, `30s * 30 iters/s`.
105+
- Having started with 2 VUs (as specified by the `preAllocatedVUs` option), k6 automatically adjusts the number of VUs to achieve the desired rate, up to the `maxVUs`. For this test, this ended up as 17 VUs.
106+
- The number of VUs to achieve the desired rate varies depending on how long each iteration takes to execute. For this test definition, if it would take exactly 1 second, then 30 VUs would be needed. However, as it takes less than 1 second, then less VUs are needed.
103107

104108
> Using too low of a `preAllocatedVUs` setting will reduce the test duration at the desired rate, as resources need to continually be allocated to achieve the rate.

docs/sources/v0.47.x/using-k6/scenarios/executors/constant-arrival-rate.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Besides the [common configuration options](https://grafana.com/docs/k6/<K6_VERSI
2929
this executor has the following options:
3030

3131
| Option | Type | Description | Default |
32-
| ------------------------------------ | ------- | ------------------------------------------------------------------------------ | ----------------------------------- |
32+
|--------------------------------------|---------|--------------------------------------------------------------------------------|-------------------------------------|
3333
| duration<sup>(required)</sup> | string | Total scenario duration (excluding `gracefulStop`). | - |
3434
| rate<sup>(required)</sup> | integer | Number of iterations to start during each `timeUnit` period. | - |
3535
| preAllocatedVUs<sup>(required)</sup> | integer | Number of VUs to pre-allocate before test start to preserve runtime resources. | - |
@@ -53,7 +53,7 @@ So it's unnecessary to use a `sleep()` function at the end of the VU code.
5353
## Example
5454

5555
This example schedules a constant rate of 30 iterations per second for 30 seconds.
56-
It allocates 50 VUs for k6 to dynamically use as needed.
56+
It pre-allocates 2 VUs, and allows k6 to dynamically schedule up to 50 VUs as needed.
5757

5858
{{< code >}}
5959

@@ -75,8 +75,12 @@ export const options = {
7575
// Start `rate` iterations per second
7676
timeUnit: '1s',
7777

78-
// Pre-allocate VUs
79-
preAllocatedVUs: 50,
78+
// Pre-allocate 2 VUs before starting the test
79+
preAllocatedVUs: 2,
80+
81+
// Spin up a maximum of 50 VUs to sustain the defined
82+
// constant arrival rate.
83+
maxVUs: 50,
8084
},
8185
},
8286
};
@@ -98,7 +102,7 @@ Based upon our test scenario inputs and results:
98102

99103
- The desired rate of 30 iterations started every 1 second is achieved and maintained for the majority of the test.
100104
- The test scenario runs for the specified 30 second duration.
101-
- Having started with 2 VUs (as specified by the `preAllocatedVUs` option), k6 automatically adjusts the number of VUs to achieve the desired rate, up to the allocated number. For this test, this ended up as 17 VUs.
102-
- Exactly 900 iterations are started in total, `30s * 30 iters/s`.
105+
- Having started with 2 VUs (as specified by the `preAllocatedVUs` option), k6 automatically adjusts the number of VUs to achieve the desired rate, up to the `maxVUs`. For this test, this ended up as 17 VUs.
106+
- The number of VUs to achieve the desired rate varies depending on how long each iteration takes to execute. For this test definition, if it would take exactly 1 second, then 30 VUs would be needed. However, as it takes less than 1 second, then less VUs are needed.
103107

104108
> Using too low of a `preAllocatedVUs` setting will reduce the test duration at the desired rate, as resources need to continually be allocated to achieve the rate.

docs/sources/v0.48.x/using-k6/scenarios/executors/constant-arrival-rate.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Besides the [common configuration options](https://grafana.com/docs/k6/<K6_VERSI
2929
this executor has the following options:
3030

3131
| Option | Type | Description | Default |
32-
| ------------------------------------ | ------- | ------------------------------------------------------------------------------ | ----------------------------------- |
32+
|--------------------------------------|---------|--------------------------------------------------------------------------------|-------------------------------------|
3333
| duration<sup>(required)</sup> | string | Total scenario duration (excluding `gracefulStop`). | - |
3434
| rate<sup>(required)</sup> | integer | Number of iterations to start during each `timeUnit` period. | - |
3535
| preAllocatedVUs<sup>(required)</sup> | integer | Number of VUs to pre-allocate before test start to preserve runtime resources. | - |
@@ -53,7 +53,7 @@ So it's unnecessary to use a `sleep()` function at the end of the VU code.
5353
## Example
5454

5555
This example schedules a constant rate of 30 iterations per second for 30 seconds.
56-
It allocates 50 VUs for k6 to dynamically use as needed.
56+
It pre-allocates 2 VUs, and allows k6 to dynamically schedule up to 50 VUs as needed.
5757

5858
{{< code >}}
5959

@@ -75,8 +75,12 @@ export const options = {
7575
// Start `rate` iterations per second
7676
timeUnit: '1s',
7777

78-
// Pre-allocate VUs
79-
preAllocatedVUs: 50,
78+
// Pre-allocate 2 VUs before starting the test
79+
preAllocatedVUs: 2,
80+
81+
// Spin up a maximum of 50 VUs to sustain the defined
82+
// constant arrival rate.
83+
maxVUs: 50,
8084
},
8185
},
8286
};
@@ -98,7 +102,7 @@ Based upon our test scenario inputs and results:
98102

99103
- The desired rate of 30 iterations started every 1 second is achieved and maintained for the majority of the test.
100104
- The test scenario runs for the specified 30 second duration.
101-
- Having started with 2 VUs (as specified by the `preAllocatedVUs` option), k6 automatically adjusts the number of VUs to achieve the desired rate, up to the allocated number. For this test, this ended up as 17 VUs.
102-
- Exactly 900 iterations are started in total, `30s * 30 iters/s`.
105+
- Having started with 2 VUs (as specified by the `preAllocatedVUs` option), k6 automatically adjusts the number of VUs to achieve the desired rate, up to the `maxVUs`. For this test, this ended up as 17 VUs.
106+
- The number of VUs to achieve the desired rate varies depending on how long each iteration takes to execute. For this test definition, if it would take exactly 1 second, then 30 VUs would be needed. However, as it takes less than 1 second, then less VUs are needed.
103107

104108
> Using too low of a `preAllocatedVUs` setting will reduce the test duration at the desired rate, as resources need to continually be allocated to achieve the rate.

docs/sources/v0.49.x/using-k6/scenarios/executors/constant-arrival-rate.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ So it's unnecessary to use a `sleep()` function at the end of the VU code.
5353
## Example
5454

5555
This example schedules a constant rate of 30 iterations per second for 30 seconds.
56-
It allocates 50 VUs for k6 to dynamically use as needed.
56+
It pre-allocates 2 VUs, and allows k6 to dynamically schedule up to 50 VUs as needed.
5757

5858
{{< code >}}
5959

@@ -75,8 +75,12 @@ export const options = {
7575
// Start `rate` iterations per second
7676
timeUnit: '1s',
7777

78-
// Pre-allocate VUs
79-
preAllocatedVUs: 50,
78+
// Pre-allocate 2 VUs before starting the test
79+
preAllocatedVUs: 2,
80+
81+
// Spin up a maximum of 50 VUs to sustain the defined
82+
// constant arrival rate.
83+
maxVUs: 50,
8084
},
8185
},
8286
};
@@ -98,7 +102,7 @@ Based upon our test scenario inputs and results:
98102

99103
- The desired rate of 30 iterations started every 1 second is achieved and maintained for the majority of the test.
100104
- The test scenario runs for the specified 30 second duration.
101-
- Having started with 2 VUs (as specified by the `preAllocatedVUs` option), k6 automatically adjusts the number of VUs to achieve the desired rate, up to the allocated number. For this test, this ended up as 17 VUs.
102-
- Exactly 900 iterations are started in total, `30s * 30 iters/s`.
105+
- Having started with 2 VUs (as specified by the `preAllocatedVUs` option), k6 automatically adjusts the number of VUs to achieve the desired rate, up to the `maxVUs`. For this test, this ended up as 17 VUs.
106+
- The number of VUs to achieve the desired rate varies depending on how long each iteration takes to execute. For this test definition, if it would take exactly 1 second, then 30 VUs would be needed. However, as it takes less than 1 second, then less VUs are needed.
103107

104108
> Using too low of a `preAllocatedVUs` setting will reduce the test duration at the desired rate, as resources need to continually be allocated to achieve the rate.

0 commit comments

Comments
 (0)