Chapter 18: Load Testing

You cannot manage what you cannot measure, and you cannot trust a measurement you have not validated. Load testing subjects a system to controlled, artificial traffic to measure its performance characteristics under various conditions. It answers questions like: how many requests per second can this system handle? At what point does latency become unacceptable? What happens when a dependency fails under load?

Load testing comes in several forms. Baseline tests measure performance under normal expected traffic. Stress tests push the system beyond its expected limits to find breaking points. Soak tests run at moderate load for extended periods to detect slow resource leaks. Spike tests simulate sudden bursts of traffic to verify the system's ability to absorb surges.

The most common mistake in load testing is testing a system in isolation rather than in the context of its dependencies. Our storage service's performance depends on the caching service's hit rate, which depends on the traffic pattern, which depends on the load test's design. Realistic load testing must exercise the full dependency chain with realistic data and access patterns.

Load test results should be compared against capacity models and SLOs (Service Level Objectives) to determine whether the system meets its requirements. The results should also be archived so that performance regressions from code changes can be detected by comparing against previous test runs.