SwadhyAI Notes

All System Design notes

System Design Reliability

Stress and Chaos Testing Methods

A load test said checkout was fine at 1× peak. Then a payment provider slowed to 2 seconds for ten minutes—a —and the API thread pool melted. Intensity was not the only enemy; partial failure was.

This note is about the : , , , and as complementary methods. For hypothesis-driven production experiments, blast radius, and game-day process, see the Chaos Engineering note—here we focus on what each method proves.

Method map

1

Find the breakpoint past expected peak.

2

Survive a sudden jump and the aftermath.

3

Hold the plateau until slow bugs appear.

4

Inject fault under realistic traffic.

What actually happens

You keep a realistic traffic shape (or a deliberate overload shape) and change one axis: intensity for stress, time for soak, step size for spike, or injected fault for chaos. Metrics and user-journey success tell you whether the fired correctly and whether restored service after the lever returned to normal.

These methods feed a . Chaos engineering’s experiment discipline (hypothesis, blast radius, guardrails) is how you safely run the riskiest entries in production. This note stays on the method taxonomy and the evidence each one should produce.

How to choose a method

1. Is the risk overload or failure? Unknown capacity → stress. Unknown flash behavior → spike. Unknown long-run stability → soak. Unknown dependency brittleness → chaos under load.

2. What is the independent variable? Arrival rate, duration, step size, or fault type. Changing two at once makes the result uninterpretable.

3. What is the pass artifact? A chart, a spike recovery curve, a soak memory trend, or a chaos pass/fail against a degradation SLO—not “we ran the tool.”

Simple rule of thumb

Load testing validates the claim. Stress finds how far past the claim you can go. Chaos checks whether the claim still holds when the world is unfair. If you only ever do one of them, customers will eventually run the others for you.

Portfolio map

Diagram text: the exact Mermaid definition below preserves the nodes, labels, and connections. Enable JavaScript to view the rendered diagram.
Read the diagram definition
flowchart TB
  subgraph Intensity["Intensity axis"]
    L[Load claim at planned peak]
    S[Stress past peak → breakpoint]
    K[Spike jump / soak duration]
  end
  subgraph Fault["Fault axis"]
    C[Chaos: kill / delay / partition]
    B[Brownout under realistic traffic]
    X[Chaos + stress combined]
  end
  L --> S
  L --> K
  L --> C
  C --> B
  S --> X
  B --> X
MethodIndependent variablePrimary evidence
Load (claim)Planned peak intensitySLO hold at N× baseline
StressIntensity past peakBreakpoint + first saturation
SpikeStep size / rise timeFirst-minute errors & recovery
SoakDuration at plateauLeak/lag trends over hours
ChaosFault type & scopeDegradation + recovery under traffic

Stress testing: finding the cliff

A starts from a known good plateau and steps upward until the journey leaves its SLO or the system collapses. Stop conditions matter: you want the , not a melted shared cluster that takes down other teams.

plaintext
Stress protocol
1. Establish 1.0× claim plateau for 10–15 min (baseline)
2. Step +0.25× every 5–10 min (or +10% relative)
3. At each step record:
   - journey success rate, P50/P95/P99
   - pool waits, CPU, disk, lock waits, queue depth
4. Breakpoint = first step where SLO fails for a sustained window
5. Hold one step below breakpoint for recovery observation
6. Archive ramp profile, build SHA, and saturating resource name

Headroom is the gap between claimed peak and breakpoint. Shipping with 2% headroom means the next marketing email is a production incident. Shipping with 50% unused headroom forever may be a cost problem—but that is a deliberate trade-off, not an accident.

Spike and soak: time as the weapon

Jump from quiet to peak (or beyond) in seconds. Watch connection establishment, DNS, TLS, cold caches, and autoscaler lag. Then drop traffic and run a : do queues drain, or do workers stay wedged?

Hold ~0.8–1.0× peak for many hours. Plot RSS, FD count, disk usage, GC pause time, and replica lag. A flat latency chart with a rising FD count is still a failing soak.

Diagram text: the exact Mermaid definition below preserves the nodes, labels, and connections. Enable JavaScript to view the rendered diagram.
Read the diagram definition
sequenceDiagram
    participant Gen as Load generator
    participant API as API fleet
    participant Dep as Dependency
    participant Obs as Observability

    Note over Gen,Obs: Spike phase
    Gen->>API: Jump 0.2× → 1.5× in 10s
    API->>Dep: Connection storm / cold cache
    Dep-->>API: Slow or refused
    API->>Obs: Error + P99 spike
    Note over Gen,Obs: Recovery phase
    Gen->>API: Drop to 0.5×
    API->>Obs: Queue depth falling?
    Obs-->>API: Pass only if backlog clears in budget

Chaos testing methods (without cloning the experiment playbook)

Build from a . For each critical journey, list faults that should be survivable: instance loss, AZ impairment, dependency , disk full on a non-leader, poison message, clock skew on a lease holder. Each entry should name the expected and the signal that proves recovery.

Fault classWhat to assertCommon miss
Process / pod killIn-flight handling; LB drain; no silent dropOnly watching replica count
Latency injectionTimeouts, budgets, breaker opensClean kill only—no brownout
Network partitionNo split-brain writes; correct fencingTesting only total isolation forever
Resource exhaustionShedding / backpressure before total hangNo FD or disk-fill drills

Combine methods when the risk demands it: stress to 1.2× while injecting a payment brownout. That is “chaos under peak”—expensive, high signal, and reserved for journeys where both overload and dependency failure are plausible together.

Worked example: checkout under brownout

plaintext
Scenario: checkout API + payment provider
Baseline load: open model at 1.0× claimed peak (200 checkout RPS)

Method A — stress only:
  Ramp to 1.8× → breakpoint at 1.55× on DB pool wait
  Artifact: headroom chart, pool size recommendation

Method B — chaos only at 1.0×:
  Inject +1.5s payment latency for 8 minutes
  Expect: deadline propagation, partial UX, no thread-pool meltdown
  Artifact: degradation path pass/fail + recovery time

Method C — combined (scheduled, tight blast):
  Hold 1.2× + payment brownout for 5 minutes
  Abort if checkout success < 97% for 60s continuous
  Artifact: proof that shedding works under both pressures

If only Method A ships, Method B’s failure still blindsides Black Friday.

From problem to mechanism

Problem. On-call keeps seeing “mystery” meltdowns when a dependency is slow, yet load tests are always green.

Naive system. Nightly load at 1× peak; occasional instance kills in staging with no journey assertions; no soak; no brownout injection.

Break it. Stress finds a comfortable breakpoint, so the team feels safe. A real occupies workers; retries amplify; the never engaged because nothing was fully “down.”

Mechanism. Maintain a ; schedule stress for headroom, soak for leaks, spikes for flash events, and chaos tests for dependency classes—each with recovery criteria.

Failure timeline: green stress, red Friday

t0  Stress test: breakpoint at 1.7× peak; claim is 1.0× — "lots of headroom"
t1  No soak; RSS slowly climbs in prod for weeks (unnoticed)
t2  Sale day: traffic 1.1× + payment brownout (p99 2s)
t3  Thread pool saturates; checkout success 91%; retries multiply arrivals
t4  Autoscaler adds pods that also block on payment — cost rises, help does not
t5  Incident review: stress answered overload; nobody tested brownout under load
t6  Fix: catalog entry + chaos brownout at 1.0× and 1.2×; soak gated on FD/RSS

Still fails when…

  • Fault injection never asserts user-journey SLOs—only infra metrics.
  • Recovery is skipped; the system sheds forever and never drains.
  • Combined peak+fault tests are banned “for safety,” so the real combo is untested.

Trade-offs

  • Stress alone is cheaper than chaos-under-peak but misses dependency realism.
  • Long soaks block environments; sample critical services on a rotating cadence.
  • Broader blast finds more bugs and creates more risk—narrow first, widen with evidence.

Operational checklist

  • Name the method and the question before picking a tool.
  • One independent variable per run; archive profiles and build SHAs.
  • Always include a window after the lever returns.
  • Abort gates tied to journey success and error-budget burn—not vanity infra graphs alone.
  • Promote catalog entries that failed into tickets with owners and a retest date.
  • Link production chaos experiments to the Chaos Engineering process note for blast radius and guardrails.

Choosing and explaining stress and chaos testing methods

A complete explanation connects the mechanism to a requirement. Describe what improves when you introduce it, which new failure cases become possible, and how you would know that the trade-off is worthwhile.

Explain the core idea

Stress finds the breakpoint past expected peak; spike and soak change time shape; chaos changes the fault axis under traffic.

A green load test at 1× peak does not prove brownout or recovery behavior—those need their own methods.

Keep a failure-mode catalog so each risk maps to a method, an expected degradation path, and a retest.

When it belongs

Capacity claims exist but headroom is unknown.

Dependencies can be slow (brownout) rather than only crash.

Incidents repeat after “successful” load tests.

How it fails

Stressing until shared infra melts without abort gates.

Injecting faults without asserting user-journey degradation.

Skipping recovery and declaring success when servers simply restart.

Trade-offs to weigh

Portfolio coverage costs calendar time; prioritize by blast and revenue risk.

Combined peak+fault tests are highest signal and highest operational risk.

Staging chaos is safer but misses real traffic mixes; production needs tighter blast controls.

Common misunderstandings

Treating chaos theater (random kills) as a substitute for a catalog and assertions.

Confusing stress headroom with resilience to dependency failure.

Cloning load-test scripts and calling them chaos because a pod was deleted once.

Wrap-up

Exercises

  1. Pick the method. Risk: “memory grows over a weekend at peak.” Which method, what plateau, what pass metric?
  2. Catalog three faults. For a ride-matching API, write three failure-mode entries with expected degradation and the test method that proves each.
  3. Design recovery. After a spike to 2× for two minutes, what signals prove the system recovered versus merely stopped taking new traffic?

Topic-specific references

Key takeaway

Stress, spike, soak, and chaos answer different questions. Build a portfolio and a failure-mode catalog so overload, time, and unfair dependencies are each proven—on purpose—before customers prove them for you.