TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/grafana/k6/llms.txt
Use this file to discover all available pages before exploring further.
constant-vus executor runs a fixed number of VUs for a specified duration. This is one of the simplest executors and is ideal for steady-state load testing where you want to maintain constant concurrent users.
How It Works
With constant VUs:- A fixed number of VUs start executing
- Each VU runs iterations in a loop
- Execution continues for the specified duration
- VUs run as many iterations as they can complete
- All VUs stop when duration expires (plus gracefulStop)
Configuration
Must be
constant-vusNumber of VUs to run concurrently. Must be greater than 0.
Total duration of the executor. Must be at least 1 second.
Example
Basic Load Test
With Thresholds
Multiple Constant Load Scenarios
When to Use
Use the constant VUs executor when:- You want to maintain a steady load on your system
- You’re testing how the system performs under sustained concurrent users
- You need predictable, consistent load over time
- You’re establishing performance baselines
- You want to verify system stability under constant load
- You’re running soak tests to detect memory leaks or degradation
Behavior Details
Iteration Loop
Each VU continuously executes the default function in a loop until duration expires:No Fixed Iteration Count
Unlike iteration-based executors, there’s no predetermined number of iterations. VUs run as many iterations as they can:Graceful Stop
When duration expires, running iterations havegracefulStop time to complete:
- 0s - 5m: Regular execution, new iterations can start
- 5m - 5m30s: Graceful stop period, no new iterations, existing ones finish
- 5m30s: All VUs forcefully stopped
Metrics
The executor emits these metrics:iterations- Total completed iterationsiteration_duration- Time to complete each iterationvus- Number of active VUs (constant at configured value)vus_max- Maximum number of VUs (same as vus)
Common Patterns
Soak Testing
Test system stability over extended periods:Steady Background Load
Maintain background load while testing something else:Different Iteration Speeds
Comparison with Other Executors
| Feature | Constant VUs | Ramping VUs | Shared Iterations |
|---|---|---|---|
| VU count | Fixed | Variable | Fixed |
| Duration | Fixed | Sum of stages | Up to maxDuration |
| Iterations | Unlimited | Unlimited | Fixed total |
| Best for | Steady load | Variable load | Fixed work |
| Predictability | High | Medium | Low (per VU) |
Best Practices
- Set realistic duration: Ensure duration matches your test objectives
- Include think time: Use
sleep()to simulate realistic user behavior - Monitor resource usage: Watch system resources throughout the constant load
- Use for baselines: Great for establishing performance baselines before ramping tests
- Configure gracefulStop: Allow enough time for iterations to complete cleanly
- Consider iteration duration: Faster iterations = more iterations = more load
Duration Requirements
See Also
- Ramping VUs - Variable VU count over time
- Constant Arrival Rate - Fixed iteration rate regardless of VUs
- Shared Iterations - Fixed iteration count instead of duration