Threshold Configuration and Scenarios
Beginnerv1.0.0
Configure k6 thresholds for pass/fail criteria and scenarios for complex load patterns — ramping, constant arrival rate, and multi-scenario test execution.
Content
Overview
Thresholds define pass/fail criteria for load tests — without them, you are observing, not testing. Scenarios define HOW load is applied — constant VUs, ramping patterns, or arrival-rate-based models.
Why This Matters
- -Thresholds turn observations into assertions — CI can gate on performance
- -Scenarios model realistic traffic patterns (gradual ramp, spike, steady state)
- -Together they create automated performance tests that catch regressions
Threshold Configuration
Basic Thresholds
Threshold with Abort
Scenario Configuration
Ramping VUs (Standard Load Test)
Constant Arrival Rate (Throughput-Based)
Multi-Scenario (Mixed Workload)
Best Practices
- -Define thresholds for EVERY load test — no threshold means no pass/fail
- -Use p95 and p99 for latency, not averages
- -Include error rate thresholds (rate<0.01) to catch functional failures
- -Use
abortOnFailfor critical thresholds to stop wasting time on broken tests - -Model at least 3 scenarios: normal load, peak load, and spike
Common Mistakes
- -Running load tests without thresholds (observation is not testing)
- -Using only average response time as a threshold (hides tail latency)
- -Not including ramp-down period (abrupt stop masks cleanup issues)
- -Setting thresholds based on hope, not baseline measurements
FAQ
Discussion
Loading comments...