Skip to content

Spike Testing

In one line

Spike testing hits the system with sudden massive traffic spikes — checks if it degrades gracefully or crashes.

In simple words

Spike testing answers: "What happens if traffic suddenly spikes 10x or 100x?" It simulates sudden, extreme traffic surges that real systems experience during viral events, product launches, or news mentions.

Real-world spike scenarios:

  • Super Bowl ad drives 50x traffic in 30 seconds
  • Celebrity tweet sends 100k visitors instantly
  • Black Friday sale starts at midnight
  • News mention causes sudden interest
  • DDoS attack (unintentional spike testing by attackers)

What spike testing checks:

  1. Graceful degradation — does it slow down or crash?
  2. Auto-scaling — does it scale up fast enough?
  3. Rate limiting — does it reject excess requests gracefully?
  4. Recovery — does it return to normal after the spike?
  5. Queue behavior — are excess requests queued or dropped?

Process: sudden jump to extreme load, hold briefly, sudden drop back to normal. Monitor response times, error rates, and recovery.

Example

javascript
// k6 spike test — sudden 10x spike
import http from 'k6/http';
import { check, sleep } from 'k6';


export const options = {
  stages: [
    { duration: '10s', target: 100 },   // normal load
    { duration: '10s', target: 1000 },  // sudden spike to 10x!
    { duration: '1m', target: 1000 },   // hold at spike
    { duration: '10s', target: 100 },   // sudden drop back
    { duration: '1m', target: 100 },    // normal load — check recovery
  ],
};

export default function () {
  const res = http.get('https://api.example.com/products');
  check(res, {
    'status is 200 or 503': (r) => r.status === 200 || r.status === 503,
    // 503 (service unavailable) is acceptable during spike
    // 500 (internal error) or timeout is NOT acceptable
  });
  sleep(0.5);
}

Spike test jumps from 100 to 1000 users instantly. Watch: does the system degrade gracefully (503) or crash (500/timeout)? Does it recover when load drops back?

Common confusions

  • Confused with: stress testing

    The difference: Stress testing gradually increases load to find the breaking point — it's about finding limits. Spike testing suddenly jumps to extreme load and back — it's about handling unexpected surges. Stress testing is gradual; spike testing is sudden. Stress testing finds the limit; spike testing tests resilience to surprises.

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary