Load Shedding and Graceful Degradation
What you'll learn: How to intentionally drop low-priority requests and reduce functionality during overload to keep your core services running.
Understanding the Problem
When your microservices face extreme traffic spikes, trying to handle every request can overload your system and cause total failure. Instead of attempting everything and failing catastrophically, you can selectively refuse work (load shedding) and simplify responses (graceful degradation) to keep critical functions alive.
Load Shedding
Load shedding means dropping requests when capacity is exceeded, like a circuit breaker that knows when it's carrying too much current. You prioritize requests by importance:
- Accept: Authentication, payment processing, critical API calls
- Reject early: Analytics tracking, non-essential reporting, preview features
Return 503 Service Unavailable or 429 Too Many Requests immediately rather than queuing requests that will timeout. This prevents resource exhaustion and keeps response times predictable for accepted requests.
Graceful Degradation
Graceful degradation means reducing service quality instead of failing completely. When under stress:
- Serve cached data instead of fresh database queries
- Return partial results instead of waiting for all downstream services
- Disable expensive features (personalization, recommendations)
- Use simplified UI without heavy assets
Think of it like a phone switching from HD video to audio-only during poor connectivity—the conversation continues.
Implementing Together
Combine both patterns: monitor system health (CPU, memory, queue depth), shed load when thresholds breach, and degrade remaining requests to lighter operations. This works alongside rate limiting and bulkhead patterns to create defense-in-depth.
Key Takeaway: Load shedding drops less-important requests during overload, while graceful degradation simplifies remaining work—together they preserve core service availability when you can't handle everything.