Docs

Load Profiles and Ramping

How to set and control load profiles and user ramping for the load tests

Overview

By default, the k6:run goal uses a ramp load pattern that gradually increases virtual users to the target count, sustains the load, then ramps back down. This produces more realistic traffic than an instant spike and avoids overwhelming the application at startup.

Load profiles control the shape of the traffic curve — how many virtual users (VUs) are active at each point during the test. Under the hood, they map to k6’s constant-vus and ramping-vus executors.

Quick Start

Source code
Default behavior (ramp up 10 s, sustain, ramp down 10 s)
mvn k6:run -Dk6.vus=50 -Dk6.duration=2m
Source code
Constant load (no ramping, previous default behavior)
mvn k6:run -Dk6.vus=50 -Dk6.duration=2m -Dk6.loadPattern=constant
Source code
Custom ramp durations
mvn k6:run -Dk6.vus=50 -Dk6.duration=5m -Dk6.rampUp=30s -Dk6.rampDown=15s
Source code
Fully custom stages
mvn k6:run -Dk6.stages="30s:20,1m:50,30s:50,15s:80,1m:80,30s:0"

Load Patterns

Pattern Description

ramp (default)

Ramp up to target VUs, sustain at full load, then ramp down to 0. Ramp-up and ramp-down durations are configurable via k6.rampUp and k6.rampDown. Uses k6’s ramping-vus executor.

constant

All VUs start immediately and run for the full duration. No ramp-up or ramp-down phase. Uses k6’s constant-vus executor.

stress

Gradually increases load beyond normal capacity with a spike phase. Stages: 50% VUs → 100% VUs → sustain → 150% spike → ramp down. Useful for finding the breaking point of the application.

soak

Quick ramp-up (5% of duration), extended sustain at target load (90%), quick ramp-down (5%). Designed for long-duration tests to detect memory leaks and gradual degradation.

custom

User-defined stages via the k6.stages parameter. Set automatically when k6.stages is provided.

Ramp Pattern (Default)

The ramp pattern divides the total duration into three phases:

  • Ramp-up — linearly increases VUs from 0 to the target over k6.rampUp duration (default 10s).

  • Sustain — holds at target VUs for the remaining time.

  • Ramp-down — linearly decreases VUs from target to 0 over k6.rampDown duration (default 10s).

The sustain duration is automatically calculated: duration - rampUp - rampDown. If rampUp + rampDown exceeds the total duration, both are scaled down proportionally.

Stress Pattern

The stress pattern is designed to push the application beyond its normal operating limits:

Five stages, each a percentage of total duration:

  1. 10% — ramp to 50% of target VUs

  2. 10% — ramp to 100% of target VUs

  3. 40% — sustain at 100%

  4. 20% — spike to 150% of target VUs

  5. 20% — ramp down to 0

Soak Pattern

The soak pattern maximizes time at target load for long-running stability tests:

Three stages:

  1. 5% of duration — ramp to target VUs

  2. 90% of duration — sustain at target

  3. 5% of duration — ramp down to 0

Custom Stages

For full control, define explicit stages as duration:target pairs. When k6.stages is set, the load pattern is automatically set to custom and the k6.vus / k6.duration parameters are ignored.

Source code
Stage format
duration:target,duration:target,...
  • duration — a k6 time string (10s, 1m, 2m30s, 1h)

  • target — the VU count to ramp to by the end of this stage

Each stage linearly transitions from the previous stage’s ending VU count (or 0 for the first stage) to its own target over the given duration. To hold load steady, repeat the same target in consecutive stages (e.g. 1m:50,30s:50 ramps to 50 then holds at 50 for 30 s).

Source code
Example: gradual ramp with plateau and spike
mvn k6:run -Dk6.stages="30s:20,1m:50,30s:50,15s:80,1m:80,30s:0"

This produces:

Reading the stages left to right:

  1. 30s:20 — ramp from 0 to 20 VUs over 30 seconds

  2. 1m:50 — ramp from 20 to 50 VUs over 1 minute

  3. 30s:50 — hold at 50 VUs for 30 seconds (same target = plateau)

  4. 15s:80 — ramp from 50 to 80 VUs over 15 seconds

  5. 1m:80 — hold at 80 VUs for 1 minute

  6. 30s:0 — ramp down from 80 to 0 over 30 seconds

Maven Configuration

Command Line

Source code
bash
# Ramp pattern with custom durations
mvn k6:run -Dk6.vus=100 -Dk6.duration=10m -Dk6.loadPattern=ramp \
    -Dk6.rampUp=1m -Dk6.rampDown=30s

# Stress test
mvn k6:run -Dk6.vus=100 -Dk6.duration=10m -Dk6.loadPattern=stress

# Soak test (long duration)
mvn k6:run -Dk6.vus=50 -Dk6.duration=1h -Dk6.loadPattern=soak

# Custom stages
mvn k6:run -Dk6.stages="1m:25,3m:50,1m:100,2m:100,1m:0"

POM Configuration

Source code
XML
<plugin>
    <groupId>com.vaadin</groupId>
    <artifactId>testbench-converter-plugin</artifactId>
    <configuration>
        <testDir>${project.build.directory}/k6/tests</testDir>
        <virtualUsers>50</virtualUsers>
        <duration>5m</duration>
        <loadPattern>ramp</loadPattern>
        <rampUp>30s</rampUp>
        <rampDown>15s</rampDown>
    </configuration>
</plugin>
Source code
Stress test configuration
<configuration>
    <testDir>${project.build.directory}/k6/tests</testDir>
    <virtualUsers>100</virtualUsers>
    <duration>10m</duration>
    <loadPattern>stress</loadPattern>
</configuration>
Source code
Custom stages configuration
<configuration>
    <testDir>${project.build.directory}/k6/tests</testDir>
    <stages>1m:25,3m:50,1m:100,2m:100,1m:0</stages>
</configuration>

Parameter Reference

Property Type Default Description

k6.loadPattern

String

ramp

Load pattern: constant, ramp, stress, soak, or custom.

k6.rampUp

String

10s

Ramp-up duration for the ramp pattern. Ignored for other patterns.

k6.rampDown

String

10s

Ramp-down duration for the ramp pattern. Ignored for other patterns.

k6.stages

String

none

Custom stage definitions (duration:target,…​). When set, overrides k6.loadPattern to custom.

k6.vus

int

10

Target number of virtual users. Used by all patterns except custom.

k6.duration

String

30s

Total test duration. Used by all patterns except custom.

Combined Scenarios

Load profiles work with combined scenario execution (k6.combineScenarios=true). Each scenario receives its own proportional VU allocation based on weights, and all scenarios share the same load profile shape.

Source code
bash
mvn k6:run -Dk6.testDir=k6/tests -Dk6.combineScenarios=true \
    -Dk6.vus=100 -Dk6.duration=5m -Dk6.loadPattern=ramp -Dk6.rampUp=30s

With two equally-weighted scenarios, each gets 50 VUs and follows the ramp pattern independently:

Source code
Scenario A:  0 ──30s──> 50 VUs ──sustain──> 50 VUs ──10s──> 0
Scenario B:  0 ──30s──> 50 VUs ──sustain──> 50 VUs ──10s──> 0

Duration Format

All duration parameters accept k6 time strings:

Format Example

Seconds

30s

Minutes

5m

Hours

1h

Combined

2m30s, 1h30m, 1h30m30s

Choosing a Pattern

Goal Recommended Pattern

Baseline performance measurement

ramp with short ramp durations (5s-10s)

Capacity planning

ramp with gradual ramp (1m+) to observe behavior as load increases

Finding breaking points

stress to push beyond normal capacity

Memory leak detection

soak with long duration (30m-1h+)

CI/CD smoke test

constant with low VUs and short duration

Reproducing specific traffic shapes

custom stages matching production patterns

Updated