Resilience & Service PatternsGraceful DegradationMedium

Degradation Strategies: Fallbacks and Defaults

Static Fallback Values

The simplest degradation returns hardcoded defaults. Recommendation service down? Return top 10 popular products, a static list updated daily. Price unavailable? Show "Price unavailable, check in store." Static fallbacks require no external calls, guaranteed to work. Store fallback data in local memory or config files.

Cached Fallback Data

More sophisticated fallbacks use cached recent data. If catalog service fails, serve from local cache, potentially 1 hour stale but better than nothing. Set TTLs (Time To Live) to survive typical outages: 15-60 minutes for frequently changing data, 24 hours for stable data.

⚠️ Key Trade-off: Cached fallbacks trade freshness for availability. Outdated prices create better UX than broken pages, but clearly indicate when data might be stale.

Feature Flags for Manual Degradation

Feature flags (configuration toggles) allow instant manual degradation. RECOMMENDATIONS_ENABLED=false removes recommendation calls across the system. During major events, preemptively disable non-essential features. Store in distributed config (Consul, etcd) for instant cluster-wide propagation.

Fallback Chains

Complex degradation uses chains: try primary, timeout after 100ms, try replica, check distributed cache, try local cache, return static default. Pattern: primary.call().orElse(replica).orElse(cache).orElse(default). Track which level served each request.

Async Fallbacks

Some operations degrade to async completion. Inventory check fails? Accept order optimistically, verify asynchronously. Payment timeout? Queue for retry, show "processing" status. Suitable when eventual consistency is acceptable and compensating actions (refunds) are possible.

💡 Key Takeaways
Static fallbacks (hardcoded defaults) require no external calls and always work
Cached fallbacks serve stale data during outages; set TTLs to survive typical incident duration
Feature flags enable instant manual degradation without deployment
📌 Interview Tips
1Explain the fallback chain pattern: primary → replica → distributed cache → local cache → static default
2Mention feature flags for proactive degradation before high traffic events
3Discuss async fallbacks for operations that can tolerate eventual consistency
← Back to Graceful Degradation Overview
Degradation Strategies: Fallbacks and Defaults | Graceful Degradation - System Overflow