ramping-vus executor (also known as stages) gradually increases or decreases the number of VUs over defined time periods. This is the most common executor for realistic load testing, as it allows you to simulate traffic patterns that ramp up, sustain, and ramp down.
How It Works
With ramping VUs:- VUs start at
startVUs(or ramp from 0) - VUs increase/decrease linearly to reach each stage’s
target - Each stage has a
durationandtargetVU count - VUs continuously run iterations throughout all stages
- Ramping is smooth and linear between targets
Configuration
string
required
Must be
ramping-vusinteger
default:"1"
Number of VUs to start with. Can be 0.
array
required
Array of stage objects defining the VU ramping pattern. Each stage must have
duration and target.duration
required
Duration of this stage. Can be 0 for instant VU changes.
integer
required
Target number of VUs at the end of this stage.
duration
default:"30s"
Time to wait for iterations to finish when ramping down VUs. This is separate from
gracefulStop.Example
Classic Load Test Pattern
Spike Test
Stress Test - Find Breaking Point
When to Use
Use the ramping VUs executor when:- You want to simulate realistic traffic patterns
- You need to test how your system handles increasing load
- You’re performing stress testing to find breaking points
- You want to observe system behavior during ramp-up and ramp-down
- You need to give your system time to warm up before peak load
- You’re testing auto-scaling behavior
Behavior Details
Linear Ramping
VUs increase/decrease linearly between targets:Zero-Duration Stages
Useduration: '0s' for instant VU changes:
Graceful Ramp Down
When ramping down, VUs getgracefulRampDown time to finish their current iteration:
Maximum VUs Reservation
k6 pre-allocates the maximum number of VUs needed across all stages:Common Load Test Patterns
Soak Test
Sustained load over a long period:Breakpoint Test
Continually increase until failure:Wave Pattern
Simulate traffic waves:Advanced Configuration
Multiple Ramping Scenarios
Metrics
The executor emits these metrics:iterations- Total completed iterationsiteration_duration- Time to complete each iterationvus- Current number of active VUs (changes over time)vus_max- Maximum number of VUs (from peak stage)
Validation
Best Practices
- Start from zero: Begin with
startVUs: 0to see system behavior from cold start - Include ramp-up: Give your system time to warm up (caches, connection pools, etc.)
- Sustain peak load: Hold peak load long enough to observe steady-state behavior
- Gradual ramp-down: Avoid instant drops to observe system recovery
- Set gracefulRampDown: Allow iterations to complete when ramping down
- Monitor throughout: Watch metrics during all stages, not just peak
- Use realistic patterns: Model actual traffic patterns from your production data
Comparison with Other Executors
See Also
- Constant VUs - Fixed VU count
- Ramping Arrival Rate - Variable iteration rate
- Externally Controlled - Manual VU control via API