Purpose
Spike tests help you:- Validate system behavior during sudden traffic spikes
- Test auto-scaling responsiveness
- Identify if the system crashes or recovers
- Verify rate limiting and throttling mechanisms
- Test circuit breakers and fallback strategies
Spike tests differ from stress tests by focusing on sudden load changes rather than gradual increases.
Configuration Pattern
Spike tests have rapid load increases:Baseline
Normal operating load
Spike
10-20x increase in seconds
Recovery
Return to normal
Using the Ramping VUs Executor
Theramping-vus executor enables rapid load changes:
Spike Test Stages
1
Establish Baseline
Start with normal load to establish baseline metrics.
2
Spike
Rapidly increase to 5-10x normal load in 30 seconds or less.
3
Maintain Spike
Hold the spike for 1-5 minutes to observe sustained behavior.
4
Recovery
Return to normal load and monitor recovery.
Multiple Spike Pattern
Test resilience to repeated spikes:Instant Spike Pattern
For testing extreme scenarios, use zero-duration stages:Using Arrival Rate for Spikes
For more realistic spike testing, use arrival rates:What to Monitor
Critical Metrics
System Behavior
Monitor these aspects during spikes:Response Times
How much do they degrade during the spike?
Error Rates
What percentage of requests fail?
Throughput
Does it scale with increased load?
Recovery Time
How long to return to normal?
Best Practices
Spike Magnitude
Choose spike size based on your scenario:- Conservative: 2-3x normal load (test auto-scaling)
- Realistic: 5-10x normal load (flash sales, viral content)
- Extreme: 20-50x normal load (DDoS simulation)
Spike Duration
Shorter spikes (1-2 minutes) test immediate response. Longer spikes (5-10 minutes) test sustained resilience.
Realistic Spike Scenarios
Simulate different spike patterns:When to Use
- Before major events: Flash sales, product launches, marketing campaigns
- DDoS resilience: Test protection mechanisms
- Auto-scaling validation: Verify rapid scaling works
- Traffic surge preparation: Viral content, breaking news
- Capacity planning: Determine maximum burst capacity
Expected Outcomes
Healthy System Response
1
Brief Degradation
Response times increase temporarily but remain acceptable
2
Auto-scaling Triggers
Additional resources provision automatically
3
Stabilization
Performance recovers within 2-3 minutes
4
Clean Recovery
System returns to baseline after spike ends
Warning Signs
Analysis Tips
Compare Pre-Spike and Spike Metrics
Key Questions
- How long until the system stabilizes after the spike?
- What is the error rate during peak spike?
- Did any services crash or become unavailable?
- Did auto-scaling respond in time?
- Were there any data inconsistencies?
- Did the system fully recover?