Skip to content

Lesson 8 of 9 · 26m

Load Shedding, Backpressure, and Graceful Degradation

Design systems to refuse or degrade work deliberately under saturation instead of collapsing indiscriminately.

Healthy systems say no. Unhealthy systems accept every request until memory, threads, connections, or patience run out, then fail everyone together. Load shedding and graceful degradation are product decisions implemented in engineering: which work matters most, what can be delayed, what can be approximate, and what should fail cleanly.

Protect the critical path first

Classify work before you need the decision:

must serve       checkout authorization, authentication, safety controls
can degrade      recommendations, personalization, analytics enrichment
can defer        emails, exports, thumbnails, reporting aggregation
can drop         nonessential beacons, verbose tracing, low-value previews

Under pressure, preserve the small set of actions that keep the business and users safe. This is why a generic 'increase capacity' answer is incomplete. Capacity arrives too late during the spike; prioritization works immediately.

Backpressure is a signal, not a moral failing

Queues grow when producers outrun consumers. The correct response is often to slow or reject upstream work:

if queue.depth() > SHED_THRESHOLD:
    raise BusyError("try again later", retry_after=5)

An unbounded queue does not absorb load; it converts overload into latency, memory pressure, stale work, and eventually a crash. Bounded queues plus explicit rejection are more honest. Time-sensitive jobs should expire rather than execute harmful actions long after the context is gone.

Shed cheaply and early

Rejection should happen before expensive work. Authentication, parsing, validation, and dependency calls all cost capacity. Edge layers can drop or throttle obviously low-priority traffic, but application-level decisions are often better because they understand tenant, endpoint, and business value. Avoid shedding randomly across critical and noncritical requests.

Graceful degradation is a feature contract

Examples:

product page: use cached inventory for 5 minutes, hide 'only 2 left'
checkout: disable express payment but preserve standard card entry
search: return sparse cached results with a freshness notice
dashboard: load core metrics, defer annotation and anomaly panels

Each degradation needs product language and correctness boundaries. Stale reads must not become stale writes. A fallback that silently fabricates availability is worse than an honest error.

Chaos-test saturation, not just failure

Inject CPU pressure, dependency latency, or reduced worker capacity. Watch queue depth, rejection rates, p95 latency for critical and noncritical classes, memory use, and recovery time. The system should degrade predictably and recover without manual heroic intervention. Recovery is part of the design; a system that sheds correctly but cannot rejoin cleanly still fails the lesson.

Field notes

  • Retry logic can defeat load shedding if clients retry rejected low-priority work aggressively.
  • Per-tenant fairness matters; one noisy customer can consume capacity needed by everyone else.
  • Cached fallbacks need freshness bounds and explicit invalidation behavior.
  • Document degraded modes before the incident. Nobody writes good product copy while the database is melting.

Was this lesson helpful?

Sign in to rate