You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/data/markdown/translated-guides/en/02 Using k6/14 Scenarios/00 Concepts/02 Arrival-rate VU allocation.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ excerpt: How k6 allocates VUs in the open-model, arrival-rate executors
6
6
In arrival-rate executors, as long as k6 has VUs available, it starts iterations according to your target rate.
7
7
The ability to set iteration rate comes with a bit more configuration complexity: you must pre-allocate a sufficient number of VUs.
8
8
In other words, before the tests runs, you must both:
9
+
9
10
- Configure load (as new iterations per unit of time)
10
11
- Ensure that you've allocated enough VUs.
11
12
@@ -25,12 +26,13 @@ As [open-model](/using-k6/scenarios/concepts/open-vs-closed/#open-model) scenari
25
26
For example, you can configure arrival-rate executors to start 10 iterations each second, or minute, or hour.
26
27
This behavior is opposed to the closed-model scenarios, in which VUs wait for one iteration to finish before starting another
27
28
28
-
Each iteration need needs a VU to run it.
29
+
Each iteration needs a VU to run it.
29
30
Because k6 VUs are single threaded, like other JavaScript runtimes, a VU can only run a single iteration (and its event loop) at a time.
30
31
To ensure you have enough, you must pre-allocate a sufficient number.
31
32
32
33
In your arrival-rate configuration, three properties determine the iteration rate:
33
-
- k6 starts `rate` number of iterations evenly across the `timeUnit` (default 1s)
34
+
35
+
- k6 starts `rate` number of iterations evenly across the `timeUnit` (default 1s).
34
36
-`preAllocatedVUs` sets the number of VUs to initialize to meet the target iteration rate.
35
37
36
38
For example, with a `constant-arrival-rate` executor and `rate: 10`, k6 tries to start a new iteration every 100 milliseconds. If the scenario has `rate: 10, timeUnit: '1m'`, k6 tries to start a new iteration every 6 seconds.
@@ -94,9 +96,9 @@ In cloud tests, the number of `maxVUs` counts against your subscription,
94
96
95
97
</Blockquote>
96
98
97
-
98
99
The arrival-rate executors also have a `maxVUs` property.
99
100
If you set it, k6 runs in this sequence:
101
+
100
102
1. Pre-allocate the `preAllocatedVUs`.
101
103
1. Run the test, trying to reach the target iteration rate.
102
104
1. If the target exceeds the available VUs, allocate another VU.
@@ -109,6 +111,7 @@ This is because k6 must allocate sufficient resources for `maxVUs` to be initial
109
111
In almost all cases, the best thing to do is to pre-allocate the number of VUs you need beforehand.
110
112
111
113
Some of the times it might make sense to use `maxVUs` include:
114
+
112
115
- To determine necessary allocation in first-time tests
113
116
- To add a little "cushion" to the pre-allocated VUs that you expect the test needs
114
117
- In huge, highly distributed tests, in which you need to carefully scale load generators as you increment VUs.
@@ -117,4 +120,3 @@ Some of the times it might make sense to use `maxVUs` include:
117
120
118
121
As with all executors, you can't predict the specific VU that an arrival-rate executor uses for a specific iteration.
119
122
As the test runs on, the executor might use some or all of the allocated VUs, even if it never needs the entire allocated number to reach the iteration rate.
0 commit comments