Degrade instead of failing
A non-critical part (recommendations, ads, analytics) is down and takes the page with it.
Say it like this
The feed must load even if ranking is down, so every non-critical call has a timeout and a default: I serve the chronological timeline from cache rather than a blank page, and a flag lets me switch ranking off without a deploy.
Basic solution
Make non-critical calls optional: timeouts with defaults, feature flags to switch them off, cached last-known-good.
Feed read with optional calls
Critical calls decide whether the page renders. Optional calls run in parallel with short timeouts and defined fallbacks, so ranking being slow costs 60 ms and a worse ordering, not the page.
How it works
- Go through every call the page makes and label it critical or optional. Critical means the page is meaningless without it, such as the post bodies in a feed; optional means the page is worse but still usable without it, such as the ranking order, the ads or the unread counts.
- Give every optional call its own timeout, shorter than the page budget, and decide in advance what the page shows if the call fails: an empty list, the last value cached for this user, or a simpler computation such as chronological order instead of ranked.
- Issue the optional calls in parallel rather than one after another, so a slow call delays the page only by its own timeout, not by the sum of everything that follows it.
- When an optional call times out or errors, the page substitutes the fallback, marks the response as degraded (a header such as X-Degraded: ranking, or a field in the log line) and increments a counter for that call.
- Put a feature flag in front of each optional call so an operator can switch it off during an incident. With the call skipped, the page stops paying the timeout on every request and the failing service stops receiving load.
- Review the critical list regularly; features drift from optional to critical as products change.
The key question
- "What breaks first, and what does the user see when it does?" Answer it for every box on the diagram before the incident.
Worked example
Home feed read path
- Page budget p99 300 ms. Calls: timeline ids from Redis (critical, 5 ms), post hydration (critical, 20 ms), ranking service (optional, 40 ms), ad insertion (optional, 30 ms), unread counts (optional, 10 ms).
- Ranking starts returning p99 of 2 s under load.
- Without degradation: every feed request waits up to 2 s, the API server thread pool of 200 fills at 100 req/s instead of 2,000, and the whole app is down for everyone, not just ranking.
- With a 60 ms timeout and a fallback to chronological order: feed p99 stays near 90 ms, users see a slightly worse feed, the degraded-response counter climbs to 100%, and the on-call gets paged for ranking, not for the site.
- Flag flipped to disable ranking entirely: the 60 ms timeout cost disappears, p99 drops to 50 ms, and ranking can be fixed without pressure. Traffic to ranking drops to zero so it can recover.
Variants and when each wins
Static default
- The fallback is a constant: an empty list, a zero, a default configuration. It wins for decoration, because it is the simplest, and users just see a missing section.
Cached last-known-good
- The fallback is the last successful response for this user or globally, served with its age attached. It wins when the data is personal and changes slowly, because users see slightly stale data instead of nothing; the cache must be filled on the happy path.
Simpler algorithm
- The fallback is a cheaper computation: chronological instead of ranked, nearest instead of ETA-sorted, exact match instead of fuzzy search. It wins when the feature is an ordering or a score, because the feature keeps working at lower quality.
Feature off by flag
- An operator removes the feature entirely until the dependency recovers. It wins during an incident, because recovery is fastest, the timeout cost disappears, and users and dashboards get a clear signal.
Recommendation: last-known-good where the data is personal and changes slowly, a simpler algorithm where the feature is ordering or scoring, static defaults for decoration, and a flag in front of all of them.
Failure modes
Optional call with no timeout
- An outage in a non-critical dependency takes the whole page down. It happens because the call inherited the HTTP client's default timeout of 30 seconds, or none at all, so every page waits on it. Set an explicit timeout on each optional call, shorter than the page budget.
Fallback never exercised
- The first time the fallback path runs in production it throws a null-pointer exception. It happens because the fallback was written but never tested. Add a test that forces the timeout and checks the fallback response, and disable the dependency in production for a few minutes during a periodic game day.
Degraded forever
- Ranking has been switched off for three weeks and nobody noticed. It happens because there is no metric on degraded responses, or the flag was flipped during an incident and never flipped back. Alert when the degraded rate stays above a threshold for more than an hour, and give every flag an owner and an expiry date.
Critical path misclassified
- The page renders with empty post bodies, which is useless to the user. It happens because post hydration was marked optional. Define critical as "the user cannot complete their task without it", and review the classification every quarter.
Timeouts still burn the budget
- The page is 60 ms slower for the entire incident, because every request waits the full timeout before falling back. It happens because the fallback is reached only through the timeout. Add a circuit breaker so that after a few failures the fallback is used immediately, and use the flag to stop calling the dependency at all.
Interviewer follow-ups
Answer out loud before you open each one.
How do you pick the timeout for an optional call?
Start from the page budget and subtract the critical path. If the page must return in 300 ms and critical work takes 50 ms, optional calls in parallel can have up to about 150 ms, leaving headroom. Then tighten to the call’s normal p99 plus a margin, so a slow dependency is cut off before it costs much.
Should the user be told the page is degraded?
For personal or financial data, yes, with a small notice and the age of what they see; silent staleness breaks trust. For ordering and decoration, no, the user cannot act on the information. Always tell your own systems through a header and a metric.
What is the relationship with circuit breakers and flags?
Degradation defines the fallback. The breaker switches to it automatically after repeated failures so you stop paying the timeout. The flag lets a human switch to it deliberately and keep it there. You want all three: the plan, the reflex, and the override.
How do you avoid degraded mode hiding a real outage?
Alert on the cause, not the symptom: the ranking service’s own error rate and the degraded-response counter both page the ranking owner. The site-wide SLO stays green, which is the point, but the dependency’s SLO goes red and someone is on it.
Connections
The same parts on other clouds
The diagrams above name AWS services as one concrete example. Every part has a close equivalent elsewhere. In an interview, name the role first, such as “a managed Redis cache”, then the product you would pick.
| AWS | Used here as | Google Cloud | Microsoft Azure | Open source and others |
|---|---|---|---|---|
| Amazon EC2 Auto Scaling | Feed service | Compute Engine managed instance groups | Virtual Machine Scale Sets | Kubernetes Deployment with a HorizontalPodAutoscaler, Nomad |
| Amazon ElastiCache | Timeline cache | Memorystore | Azure Managed Redis | Redis, Valkey, Memcached |
| Amazon Aurora | Post store | AlloyDB for PostgreSQL, Cloud SQL | Azure Database for PostgreSQL or MySQL | PostgreSQL, MySQL, CockroachDB |
| Amazon SageMaker | Ranking | Vertex AI | Azure Machine Learning | KServe, Ray Serve, NVIDIA Triton |