|
2 | 2 |
|
3 | 3 | ## Antipattern 1: Ignoring Think Time |
4 | 4 |
|
5 | | -Excluding think time between user actions can result in unrealistic performance |
6 | | -metrics for certain types of tests, such as average, stress, and soak tests. |
7 | | -However, think time is less critical for tests like breakpoint and spike tests, |
8 | | -as other parameters can control these scenarios effectively. Incorporating |
9 | | -think time is crucial when simulating real user behavior based on user |
10 | | -scenarios. In the provided example, user actions are executed without any delay, |
11 | | -which does not accurately reflect real-world conditions for this type of test. |
| 5 | +Excluding think time between user actions can result in unrealistic performance metrics for certain types of tests, such as average, stress, and soak tests. However, think time is less critical for tests like breakpoint and spike tests, as other parameters can control these scenarios effectively. Incorporating think time is crucial when simulating real user behavior based on user scenarios. In the provided example, user actions are executed without any delay, which does not accurately reflect real-world conditions for this type of test. |
12 | 6 |
|
13 | 7 | ```javascript |
14 | 8 | export default function () { |
@@ -84,7 +78,7 @@ export default function () { |
84 | 78 |
|
85 | 79 | ### Solution |
86 | 80 |
|
87 | | -Executors control how k6 schedules VUs and iterations. The executor that you choose depends on the goals of your test and the type of traffic you want to model. For example, the `ramping-vus` executor gradually increases the number of VUs over a specified duration, allowing for more realistic load testing for specific test types. |
| 81 | +Executors control how K6 schedules VUs and iterations. The executor that you choose depends on the goals of your test and the type of traffic you want to model. For example, the `ramping-vus` executor gradually increases the number of VUs over a specified duration, allowing for more realistic load testing for specific test types. |
88 | 82 |
|
89 | 83 | ```javascript |
90 | 84 | export const options = { |
@@ -112,13 +106,28 @@ export default function () { |
112 | 106 |
|
113 | 107 | Based upon our test scenario inputs and results: |
114 | 108 |
|
115 | | -- The configuration defines 2 stages for a total test duration of 30 seconds; |
116 | | -- Stage 1 ramps up VUs linearly from the startVUs of 0 to the target of 10 over a 20 second duration; |
117 | | -- From the 10 VUs at the end of stage 1, stage 2 then ramps down VUs linearly to the target of 0 over a 10 second duration; |
118 | | -- Each iteration of the default function is expected to be roughly 515ms, or ~2/s; |
119 | | -- As the number of VUs changes, the iteration rate directly correlates; each addition of a VU increases the rate by about 2 iters/s, whereas each subtraction of a VU reduces by about 2 iters/s; |
| 109 | +- The configuration defines 2 stages for a total test duration of 30 seconds. |
| 110 | +- Stage 1 ramps up VUs linearly from the 0 to the target of 10 over a 20 second duration. |
| 111 | +- From the 10 VUs at the end of stage 1, stage 2 then ramps down VUs linearly to the target of 0 over a 10 second duration. |
| 112 | +- Each iteration of the default function is expected to be roughly 515ms, or ~2/s. |
| 113 | +- As the number of VUs changes, the iteration rate directly correlates; each addition of a VU increases the rate by about 2 iterations/s, whereas each subtraction of a VUs reduces by about 2 iterations/s. |
120 | 114 | - The example performed ~300 iterations over the course of the test. |
121 | 115 |
|
122 | 116 | #### Chart representation of the test execution |
123 | 117 |
|
124 | 118 |  |
| 119 | + |
| 120 | +## Glossary |
| 121 | + |
| 122 | +### **VU** |
| 123 | + |
| 124 | +- Virtual User |
| 125 | + |
| 126 | +### **Think Time** |
| 127 | + |
| 128 | +- Amount of time a script stops during test execution to |
| 129 | +replicate delays experienced by real users while using an application. |
| 130 | + |
| 131 | +### **Iteration** |
| 132 | + |
| 133 | +- A single execution of the default function in a K6 script. |
0 commit comments