Load Profiles and Ramping
- Overview
- Quick Start
- Load Patterns
- Maven Configuration
- Parameter Reference
- Combined Scenarios
- Duration Format
- Choosing a Pattern
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=2mSource code
Constant load (no ramping, previous default behavior)
mvn k6:run -Dk6.vus=50 -Dk6.duration=2m -Dk6.loadPattern=constantSource code
Custom ramp durations
mvn k6:run -Dk6.vus=50 -Dk6.duration=5m -Dk6.rampUp=30s -Dk6.rampDown=15sSource 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 up to target VUs, sustain at full load, then ramp down to 0.
Ramp-up and ramp-down durations are configurable via |
| All VUs start immediately and run for the full duration.
No ramp-up or ramp-down phase.
Uses k6’s |
| 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. |
| 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. |
| User-defined stages via the |
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.rampUpduration (default10s). -
Sustain — holds at target VUs for the remaining time.
-
Ramp-down — linearly decreases VUs from target to 0 over
k6.rampDownduration (default10s).
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:
-
10% — ramp to 50% of target VUs
-
10% — ramp to 100% of target VUs
-
40% — sustain at 100%
-
20% — spike to 150% of target VUs
-
20% — ramp down to 0
Soak Pattern
The soak pattern maximizes time at target load for long-running stability tests:
Three stages:
-
5% of duration — ramp to target VUs
-
90% of duration — sustain at target
-
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:
-
30s:20— ramp from 0 to 20 VUs over 30 seconds -
1m:50— ramp from 20 to 50 VUs over 1 minute -
30s:50— hold at 50 VUs for 30 seconds (same target = plateau) -
15s:80— ramp from 50 to 80 VUs over 15 seconds -
1m:80— hold at 80 VUs for 1 minute -
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 |
|---|---|---|---|
| String |
| Load pattern: |
| String |
| Ramp-up duration for the |
| String |
| Ramp-down duration for the |
| String | none | Custom stage definitions ( |
| int |
| Target number of virtual users. Used by all patterns except |
| String |
| Total test duration. Used by all patterns except |
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=30sWith 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──> 0Duration Format
All duration parameters accept k6 time strings:
| Format | Example |
|---|---|
Seconds |
|
Minutes |
|
Hours |
|
Combined |
|
Choosing a Pattern
| Goal | Recommended Pattern |
|---|---|
Baseline performance measurement |
|
Capacity planning |
|
Finding breaking points |
|
Memory leak detection |
|
CI/CD smoke test |
|
Reproducing specific traffic shapes |
|