Menu
Choose a product
Viewing: v1.7.x (latest)
Find another version
Scroll for more
Documentation
Grafana k6
JavaScript API
jslib
utils
normalDistributionStages(maxVus, durationSeconds, [numberOfStages])
Open source
normalDistributionStages(maxVus, durationSeconds, [numberOfStages])
Function to create stages producing a normal distribution (bell-curve) of VUs for a test.
| Parameter | Type | Description |
|---|---|---|
| maxVus | int | Maximum virtual users at the height of the curve |
| durationSeconds | int | Overall duration for all stages combined |
| numberOfStages (optional) | int | Number of stages to create; default is 10 |
Returns
| Type | Description |
|---|---|
| array[object] | An array of {"duration": "XXXs", "target": XXX} JSON objects representing stages |
Example
JavaScript
JavaScript
import { sleep } from 'k6';
import exec from 'k6/execution';
import { normalDistributionStages } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';
export const options = {
// Alters the number of VUs from 1 to 10 over a period
// of 20 seconds comprised of 5 stages.
stages: normalDistributionStages(10, 20, 5),
};
export default function () {
console.log(exec.instance.vusActive);
sleep(1);
}Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video

Performance testing and observability in Grafana Cloud
Optimize user experiences with Grafana Cloud. Learn real-time insights, performance testing with k6, and continuous validation with Synthetic Monitoring.
Events

User-centered observability: load testing, real user monitoring, and synthetics
Learn how to use load testing, synthetic monitoring, and real user monitoring (RUM) to understand end users' experience of your apps. Watch on demand.