Designing Load Shedding: Keep Critical Requests Working During Overload
Load shedding deliberately rejects or skips some new work when a service exceeds its capacity, preventing a local overload from bringing down the whole system. The goal is not to discard every request equally: protect the constrained resource and preserve essential work where possible.
Load shedding deliberately rejects or skips some new work when a service exceeds its capacity, preventing a local overload from bringing down the whole system. The goal is not to discard every request equally: protect the constrained resource and preserve essential work where possible.
Why it matters
When demand exceeds capacity, queues and in-flight work grow and responses slow down. Slow responses can miss client deadlines and trigger retries, adding more load and potentially knocking out otherwise healthy instances. Shedding does not add capacity; it preserves useful throughput by preventing excess work from exhausting CPU, memory, connections, or dependencies.
Distinguish it from graceful degradation, which makes each request cheaper by omitting optional features. Load shedding rejects work that remains unaffordable even after degradation. The two can be combined.
Design the policy
**Identify the bottleneck and protected work.** Measure the actual limit: CPU, heap, execution slots, queues, or database connections. Classify flows by business impact, such as payment or read requests to preserve and recommendations or previews that can be delayed or omitted. Use information available before expensive work begins.
**Choose where to reject.** Rejecting before expensive work starts consumes fewer resources. A gateway can quickly reject new connections or requests but may lack business context; an in-service decision can classify work better but may already have spent resources. Give health and management paths independent limits if they must remain available.
**Use graduated actions and a hard limit.** As headroom shrinks, omit optional features or reduce concurrency; under greater pressure, quickly reject new work. Observe resource pressure alongside queue depth, latency, and useful successful throughput. Set thresholds through capacity testing, not universal CPU or memory percentages.
**Design client behavior and recovery.** Make clear whether a rejection is retryable and when to retry. Clients need deadlines, exponential backoff, and jitter. Immediate retries without a retry budget turn rejection into more load. Check that acceptance does not surge abruptly when pressure falls.
Interpreting an Envoy example
Envoy v1.32.7 documentation shows an example that drains HTTP connections at 92% heap use, returns 503 for new requests at 95%, and stops accepting new TCP connections at 95%. These are version-specific example values, not recommended defaults for other services. The docs also describe scaled triggers that change behavior gradually between thresholds and metrics for resource pressure and shed load. Verify supported monitors and actions against the Envoy version and configuration in use.
What to verify
In a test environment, increase load gradually from normal levels past capacity. Confirm optional features are reduced first and critical request success is preserved. Track queue length and wait time, 5xx and rejection rates, resource pressure, retry volume, and useful successful throughput together. Record recovery as load subsides; check whether management paths still respond and whether the policy's behavior is defined when its signal fails. No Envoy configuration or load test was performed here.
Sources
[Google SRE Book: Addressing Cascading Failures](https://sre.google/sre-book/addressing-cascading-failures/)
[Google SRE: Production Services Best Practices — Overloads and Failure](https://sre.google/sre-book/service-best-practices/)
[Envoy v1.32.7 Overload Manager](https://www.envoyproxy.io/docs/envoy/v1.32.7/configuration/operations/overload_manager/overload_manager)