advanced
Fallbacks
Serve degraded behavior only when stale data, defaults, cached reads, or disabled features are safer than hard failure.
Fallbacks return degraded but useful responses when dependencies fail: cached prices, default recommendations, feature toggled off. They trade freshness or completeness for availability — only when stale or partial data is safer than errors.
On interviews: design fallbacks for product recommendations when ML service is down; state staleness limits and user messaging.
Common pitfalls: silent wrong data worse than error; fallback path untested; cascading fallback to another failing service.
The trade-off is flexibility versus complexity—know when the simpler path is enough.
Checklist:
- Define which fields may degrade and TTL of cache.
- Surface degradation honestly in UI or metadata.
- Test fallback paths in chaos drills.
- Monitor fallback invocation rate.