← Workflows

阅读中文版本

Load Shedding Tuning Workflow

Add load shedding so overload drops low-priority work early instead of collapsing the whole service.

advanced~70 minperformanceresiliencereliability

Objective

Protect critical traffic by shedding lower-priority load when the service is overloaded.

Environment

  • Priority classification for requests
  • Metrics for queue depth and latency
  • A shedding mechanism

Steps

1. Classify request priority

Define which requests are critical and which can be deferred or dropped.

Expected state: Traffic has an explicit priority order.

2. Set shedding thresholds

Trigger shedding when queue depth or latency crosses a threshold.

Expected state: Shedding activates before full collapse.

3. Shed lower priority first

Drop or defer low-priority work while serving critical traffic.

Expected state: Critical requests keep succeeding under overload.

4. Verify graceful degradation

Load the service past capacity and confirm it degrades rather than fails.

Expected state: The service sheds load and recovers, clients get clear errors.

Decision points

Shed or queue?

  • Shed low priority early
  • Queue everything

Shed early; unbounded queues convert overload into timeout failures.

Who defines priority?

  • Product and engineering together
  • Engineering alone

Product defines what matters most; engineering implements the mechanism.

Expected outcome

Under overload the service sheds low-priority work and continues serving critical requests.

Verification

Confirm that past capacity, critical requests still succeed and shed requests receive a clear retryable error.

Cleanup

Document the priority rules and thresholds and tune from incident data.

Overview

Protect critical traffic by shedding lower-priority load when the service is overloaded.

This workflow is reusable across teams and environments; adapt the commands to your tooling while keeping the sequence and checkpoints intact.

Environment and prerequisites

  • Priority classification for requests
  • Metrics for queue depth and latency
  • A shedding mechanism

Procedure

1. Classify request priority

Define which requests are critical and which can be deferred or dropped.

Expected state: Traffic has an explicit priority order.

2. Set shedding thresholds

Trigger shedding when queue depth or latency crosses a threshold.

Expected state: Shedding activates before full collapse.

3. Shed lower priority first

Drop or defer low-priority work while serving critical traffic.

Expected state: Critical requests keep succeeding under overload.

4. Verify graceful degradation

Load the service past capacity and confirm it degrades rather than fails.

Expected state: The service sheds load and recovers, clients get clear errors.

# shed when queue depth exceeds capacity
if queue.depth > 1000 { rejectLowPriority() }

Verification

Confirm that past capacity, critical requests still succeed and shed requests receive a clear retryable error.

Decision points

Shed or queue?

  • Shed low priority early
  • Queue everything

Recommendation: Shed early; unbounded queues convert overload into timeout failures.

Who defines priority?

  • Product and engineering together
  • Engineering alone

Recommendation: Product defines what matters most; engineering implements the mechanism.

Common failures

  • No shedding means overload collapses everything.
  • Unbounded queues turn overload into timeouts.
  • Shedding critical traffic harms the users who matter most.