Resilience Patterns · Verifying Resilience

Load, Stress and Soak Testing

Know your limits and how the system behaves past them.

Load tests verify performance at expected peak; stress tests push beyond to find the breaking point and how it fails (gracefully with 503s, or collapsing); soak tests run for hours to reveal leaks and slow degradation; spike tests apply sudden bursts. Use realistic traffic mixes and data, open-model arrival rates, production-like environments, and watch resource saturation and dependency limits, not just response times.

Test types

Test Question answered Duration
Load Do we meet SLOs at expected peak? 30–60 min
Stress Where and how do we break? Ramp until failure
Soak Do we leak or degrade over time? Hours–days
Spike Do we survive sudden bursts? Minutes
Failover under load Does resilience work when busy? During load test

k6 (stress to breaking point)

import http from "k6/http";
export const options = {
  scenarios: { stress: { executor: "ramping-arrival-rate", startRate: 200, timeUnit: "1s", preAllocatedVUs: 2000,
    stages: [{ target: 2000, duration: "10m" }, { target: 5000, duration: "10m" }, { target: 0, duration: "2m" }] } },
  thresholds: { "http_req_failed{status:503}": ["rate<0.5"], http_req_duration: ["p(99)<1500"] },
};
export default () => http.get(`${__ENV.BASE}/api/products?limit=20`);

Common pitfalls

  • Testing only the happy path at average load.
  • Closed-model generators hiding latency (coordinated omission).
  • Ignoring third-party limits in tests (use stubs).

Key points

  • Load, stress, soak, spike
  • Observe failure behavior
  • Realistic traffic and arrival rates

Further reading: k6: Test types

Practice questions

What does a good stress test result look like?

Answer

Past capacity the system sheds load (fast 429/503) while keeping goodput steady and recovers quickly when load drops — not timeouts and a collapse.

What problems do soak tests reveal?

Answer

Memory/connection leaks, growing queues, log/disk growth, cache fragmentation and performance that degrades over hours.

Open in the app to mark lessons complete, take notes and track your progress.