The shape
A service you depend on is down, slow, or returning old data. You have two options. You can fail the whole request, or you can return an answer with a part missing. Returning the smaller answer is graceful degradation, and it only works if you decided beforehand which part can go missing.
The decision is cheap before the incident and impossible during it. That gap is why this is a pattern you plan for, not something you work out during the incident. At 3am, with a dashboard full of red, nobody is going to work out that "the recommendation carousel is optional but the price is not." That decision has to be in the code already, made in a design review by somebody who had time to think.
Many decisions look different on the surface and are the same decision underneath. You choose which reads may be stale, and by how much. You choose which parts of a page are allowed to be missing. You choose to fall back to a local rate limit when the shared counter store is unreachable. You choose which operations may go ahead during a network partition, when some machines cannot reach the others. You choose to serve an expired cache entry rather than nothing. All five ask one question: which part of this answer is optional?
The ladder
Degradation is not all or nothing. There is a series of things you can give up, one after another. The useful habit is to write them down in order, from the best answer to the worst. That ordered list is the ladder, and writing it down is the design.
Most systems build only the first step and the last one. So a single late dependency takes the whole request from a perfect answer to no answer. Users would have accepted any of the six answers in between. None of them exists, because nobody built them.
Where the parts come from
There are four places to find a part you can give up. They are listed roughly in order of how often each one is the right answer.
Optional sections. A page has a required core and a set of extras, such as recommendations, related items, activity counts and personalisation. Each service that supplies an extra is a contributor, and each contributor gets a deadline. If a contributor misses its deadline, the page drops its section instead of waiting for it. This source is worth the most, because the page now takes as long as the core takes, not as long as the slowest contributor.
Stale instead of absent. An expired cache entry is almost always better than an error. You serve it, mark it as old, and refresh it in the background. This needs a second timeout, and it is the setting people forget. The TTL (time to live) says when an entry counts as expired. The second timeout says when an entry is too old to serve at all. It is a different number from the TTL, and it should be much larger.
Approximate instead of exact. Counts, rankings, recommendations and quota checks can usually live with an approximate answer. A rate limiter that has lost its shared data store can fall back to a limit per instance, where each server counts only its own traffic. Added up across all the servers, that limit is wrong. It is still much better than failing open, which lets every request through, or failing closed, which rejects every request.
Local instead of shared. When a shared dependency is unreachable, there is often a local copy or estimate of it to use instead. Examples are each instance's own view, a snapshot shipped with the code, or the last-known-good config, the most recent one that worked. The fallback is worse, but it is there.
The rule that prevents cascades
One form of degradation is not about answers. It belongs here because getting it wrong turns a small failure into an outage.
A component at its capacity limit should shed or spill, not die. Shedding means rejecting the extra requests cheaply. Spilling means passing them on to the next node. This matters most in a tier where each request goes to a node chosen by its key, such as a cache ring, a sharded store, or a service routed by consistent hashing. In those tiers, a node that dies does not take its load away with it. The load moves onto a neighbour. The neighbour is now more likely to die, and if it does, it passes even more load to the next node. That chain is a cascade. So at its ceiling, a node should reject cheaply, spill to the next node, or serve something degraded. It should not fall over.
The same thinking applies to a replica that has fallen behind. If its health check passes, a lagging replica will keep serving data from 40 minutes ago. The health check asks whether the process is alive, not whether its data is current. Liveness and correctness are different questions. A read pool should remove a replica automatically once it falls further behind than a set threshold. Nobody should have to make that call by hand during an incident.
A page assembled from 1 core call and 4 optional contributors,
each independently slow (above its p99) 1% of the time.
Wait for everyone
P(at least one is slow) 1 − 0.99^5 = 4.9%
→ ~1 request in 20 is as slow as the worst
of 5 services
Drop any contributor past a 50 ms deadline
P(the page is slow) = P(the CORE is slow)
= 1.0%
→ the page's latency is now the core's latency
─────────────────────────────────────────────────────
4.9% → 1.0%, and the cost is that about 4 percent of
page views are missing one optional section.
The question is not technical. It is whether a missing
recommendation strip is worse than a page that takes
2 seconds, and product owns that answer.How to tell you need this
Here is the symptom. If a page calls 6 services and every one of them has to succeed, the page's availability is the product of all six, not close to any one of them. Say each of the 6 services is up 99.9 percent of the time. The chance that all 6 are up at once is 0.999^6, about 99.4 percent. So the page is less reliable than any single service it depends on.
In a design review, the check is simpler. Pick a dependency by name, ask what happens if it returns nothing, and see whether the answer is specific. "It would fail" is honest. "It would fail, and that is correct because the data is required" is a decision. "I am not sure" means the ladder has only its first and last steps.
What it costs
This pattern has three costs. In order, they are a second code path, degraded answers that nobody can tell are degraded, and the operations that must never degrade at all.
Every degraded mode is a second code path. That means a second set of behaviours to test, monitor and reason about. Two working paths are more than twice the work of one, because you also own the switch from one path to the other.
Degraded answers need to be visible. If they are not, you will serve them for months without anyone noticing. A stale answer with no timestamp, or a partial page that does not show a section is missing, leads to support tickets nobody can reproduce. Emit a metric for each degraded mode, and alert on how often each one is used, not only on the errors it replaced.
The third cost is that some things must never degrade. Examples are a balance check before a withdrawal, an authorisation decision and a payment. Naming those is as much a part of this pattern as naming the optional parts. A design that degrades everything is as badly thought through as one that degrades nothing.
Where it shows up in the course
| article | the form it takes there |
|---|---|
| Auth: Sessions, JWT and OAuth | when renewing a session fails, the gateway lets an identity it already checked through, but never one it has not checked |
| Caching Strategies and Invalidation | what the backend does when the cache disappears and it meets 100x its normal load |
| CAP and What It Actually Constrains | deciding in advance which operations may proceed during a partition |
| Capacity Planning and Autoscaling | a fleet below its full reserve runs past its knee until new instances arrive, so decide beforehand what it drops in those minutes |
| CDNs and Edge Compute | an edge region failing over and sending its full miss traffic at the origin at once |
| Circuit Breakers, Bulkheads and Backpressure | the whole family, derived from Little's Law, and what to serve when a breaker is open or a request is shed |
| Consistency Models | deciding which reads may be stale, and by how much |
| Consistent Hashing | shedding at the ceiling instead of dying, so one hot key cannot cascade |
| Deployments: Blue-Green and Canary | a kill switch is a degraded mode decided in advance: the flag turns a listed feature off under load without a deploy |
| Design a Distributed Job Scheduler | when a pool runs short, windowed runs wait inside their windows and strict runs go first |
| Design a Distributed Message Queue | a partition below its in-sync minimum refuses acks=all writes with a retryable error and keeps serving reads |
| Design a Leaderboard / Ranking Service | with Redis down, matches are still recorded, responses leave out the rank, and the edge serves a stale top 100 |
| Design a Payment System | new payments fail over to a second processor or wait; an unknown call is resolved only where it was sent, with its own key |
| Design an Ad Click Aggregator | when the stream job is down, clicks are still recorded and the counts go stale with their age shown |
| Design Google Docs (Collaborative Editing) | cursors are the optional part of a shared session: an overloaded owner stops passing them on and keeps numbering edits |
| Design Yelp (Nearby Places) | search, place pages and photos keep serving from each region's copies; only posting a review or a photo, or editing a place, fails, with a retryable error |
| Distributed Cache | a gutter pool decides in advance what a dead node costs: values up to a minute stale, and part of its reads reaching the databases |
| Distributed Rate Limiter | failing open to a local limit rather than to unlimited, so the fallback is a worse answer and not no answer |
| Dropbox and Google Drive | without hints devices list on a timer, and sync slows from seconds to minutes instead of stopping |
| shedding full-size image requests while thumbnails keep serving | |
| Key-Value Store | a partition without a leader keeps serving eventual reads while its writes fail with a retryable error |
| Latency Numbers That Matter | returning a partial answer when a contributor misses its deadline |
| Load Balancing | what a balancer does when every backend is failing health checks, where the obvious answer makes it worse |
| Multi-Region and Disaster Recovery | moving a failed region's users into a cold cache is a planned overload, so decide in advance what the surviving region stops doing |
| Notification Service | the type registry decides in advance: campaigns wait or drop, sign-in codes use the reserved quota or the second provider |
| Observability: Metrics, Logs and Traces | telemetry is the optional part of every request: DEBUG lines and sampled successes drop first, error lines and SLI counters never |
| Push Notification Delivery | deciding in advance which pushes wait when the provider throttles you: promotions wait, sign-in codes go first |
| Replication and Leader Election | ejecting a lagging replica from the read pool on a staleness threshold |
| Search Autocomplete | personal and trending suggestions drop first, then freshness, then all suggestions, and none of them ever blocks the search |
| Security in System Design | a protective check degrades to a weaker check, such as a local rate limit, and never to no check |
| Ticketmaster Booking | the waiting line is the degraded mode: when checkout struggles, a new buyer waits longer instead of getting an error |
| Uber Ride-Hailing | the map, surge and match quality may degrade; the claim, the accept, the quoted price and the charge may not |
| Web Crawler | DNS, uploads and slow sites may wait; politeness and robots.txt never degrade |
| WebSockets, SSE and Polling | each transport as the fallback for the one above it, down to plain polling when the push tier is out |
| WhatsApp and Chat Systems | presence, typing and receipt counts as the optional parts, shed under load so message delivery stays whole |
| YouTube | shedding renditions under transcode backlog, so a video is available at 480p rather than not at all |
| Live Comments and Reactions | under load the comment cap, the batch window and the reaction totals shrink first; removals and the archive never do |
Getting it wrong
Having only two steps on the ladder. The system returns either the full answer or an error. Every answer in between has to be built on purpose. If none exists, every dependency is in effect required.
A fallback nobody has run. A degradation path that was never tested fails when it is finally used, and that happens during an incident. Run each one on a schedule.
Degrading silently. If a degraded answer looks the same as a good one, you can end up serving it permanently by accident. Mark it, measure it, and alert on how often it happens.
Failing open on something that protects you. A rate limiter that lets everything through when its store is down is no longer limiting anything. Fall back to a local approximation instead, so the protection is weaker but still there.
Treating a health check as a correctness check. A process can be alive while its data is out of date. These need separate signals.
Degrading the thing that mattered. Some answers have no acceptable approximation. The list of what must never degrade is part of this pattern, not an exception to it.