Course map

Topic 199 / Core

Load, stress, spike and soak testing

Chapter 12.3 · Testing Strategies

What and why

The test levels in → 197 ask "is the behavior correct?"; performance tests ask a different question — "does it stay correct and fast enough under real traffic, and what happens when traffic exceeds what was planned for?" Four tests answer different parts of that: load (expected traffic — do SLOs hold, → 203), stress (rising traffic until something breaks — what breaks, and how), spike (a sudden surge — does it recover), soak (hours of sustained traffic — do leaks or slow degradation appear). Builds on: → 197 (testing strategy and test levels).

Diagram

Test Traffic shape Question answered
Load expected/peak, steady do SLOs (→ 203) hold at the traffic we actually expect?
Stress rising past expected, until failure where is the breaking point, and what fails first?
Spike sudden jump, then hold or drop does the system survive and recover from a surge?
Soak expected load, sustained for hours do leaks (→ 8) or slow degradation appear over time?

How it works

  1. Load test at the traffic level capacity planning (→ 102) says to expect; confirm the stated SLO (→ 203) — e.g., p99 latency and error rate — actually holds at that level.
  2. Stress test by increasing load past expected until something gives way; record what fails first (a connection pool, → 77; a CPU ceiling; a downstream dependency) and whether the failure is a clean, bounded degradation or an uncontrolled collapse.
  3. Spike test with a traffic shape that jumps quickly rather than ramping — this exercises auto scaling's reaction lag (→ 95) and load shedding (→ 97) specifically, not steady-state capacity.
  4. Soak test by holding expected load for hours, not minutes — this is the only test level that reliably surfaces a slow memory leak (→ 8) or a resource that's never released, both invisible in a short run.
  5. Run all four with realistic data shapes and a warm cache (→ 82) unless the test's explicit goal is to measure a cold start — an unrealistic test answers a question nobody asked.

Practical example

(illustrative). A service is rated for 500 requests/second. A load test at 500 req/s confirms p99 = 180 ms, under its 200 ms SLO. A stress test ramps from 500 upward and finds the error rate crosses 5% at 1,200 req/s, where the database connection pool (→ 77) saturates first — the actual breaking point, 2.4× rated capacity. A spike test jumps from 200 to 1,000 req/s in 10 seconds and confirms p99 recovers to baseline within 90 seconds of the spike ending. A soak test at 400 req/s for 12 hours shows process memory growing at roughly 50 MB/hour — a leak invisible in any test shorter than a few hours.

When to use it

  • Use before any launch, capacity change, or seasonal traffic event where the system hasn't been proven at the relevant load (feeds → 102, → 207).
  • Avoid running destructive stress tests against shared production infrastructure without isolation — a stress test that finds the breaking point by actually breaking the real system for real users has defeated its own purpose.
  • Failure scenarios: a load test run only against a warm cache, missing the cold-start reality of a real deploy; a soak test cut short at one hour, missing a leak that only shows up after several; declaring a stress test "passed" because nothing crashed, without checking how it degraded (cleanly, or by corrupting data).
  • Simpler alternative: for a low-traffic internal tool, a single load test at roughly 2× expected peak, run once before launch, may be the entire performance-testing budget it needs — skip stress/spike/soak until real traffic growth justifies them.

Practice

(process kind — fill the template against a small local target; 20–30 min, lab: Redis or Postgres behind a tiny script). Build a small endpoint backed by Redis or Postgres; write a basic load generator (any language, a simple loop with concurrency) that can hold a fixed request rate. Run it at a chosen "expected" rate for 1 minute (load test), then ramp upward until errors appear (stress test) and record the breaking point and what saturated first. Done when you can state, with a number, the rate at which the system first breaks and the specific resource that broke.

Shared lab setup

Key takeaway

Load tests prove the expected case holds; stress, spike, and soak tests each ask a different question about the unexpected case — and only a sustained soak test reveals a slow leak. Done when you can: name which of the four tests answers a given reliability question and state what resource is likely to fail first under stress. Used next in → 200 (resilience and chaos testing, failure injection beyond pure load), → 102 (capacity planning, where these results feed sizing), → 207 (production readiness, a load test as a launch gate).

References

Site Reliability Engineering, 2nd edition — see references.md.

Source directory

Search the guide