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/docs/05 Examples/01 Examples/24 distribute-workloads.md
+2-7Lines changed: 2 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,6 @@ k6 can schedule different load patterns for different VU functions.
8
8
A test with multiple workloads might better simulate traffic in the real world, where user behavior is rarely uniform.
9
9
For example, most traffic to an e-commerce site might come from users who only search for items and read reviews. A small percentage of users might actively shop, performing actions that involve writes to the database and calls to different APIs.
10
10
11
-
12
11
The following sections provide examples of how to structure k6 scripts to split logic across VUs.
13
12
To inspect the results for a certain behavior, you can [create a custom metric](/using-k6/metrics/create-custom-metrics) or use [Tags](/using-k6/tags-and-groups) to filter by scenario, code block, or individual request.
14
13
@@ -19,7 +18,6 @@ However, more complexity creates more ambiguity in result interpretation
19
18
20
19
</Blockquote>
21
20
22
-
23
21
## Split logic across scenarios
24
22
25
23
<Blockquotemod="note"title="">
@@ -28,7 +26,6 @@ In this context, _workload_ refers to the traffic pattern simulated by a scenari
28
26
29
27
</Blockquote>
30
28
31
-
32
29
One way to distribute traffic is to use scenarios to schedule different workloads for different functions.
33
30
1. Define multiple scenarios in your [options](/using-k6/options).
34
31
1. Use the scenario `exec` property to execute different VU functions with a workload.
@@ -88,11 +85,11 @@ if (exec.vu.idInTest <= 25) {
88
85
```
89
86
90
87
91
-
For more flexibility, you can use modulo expressions distribute VUs according to percentages.
88
+
For more flexibility, you can use modulo expressions to distribute VUs according to percentages.
92
89
For example, the following script distributes logic according to different user profiles:
0 commit comments