Part 6 of 8 · 2 min read
Graceful degradation
Do less, but keep the core.
When the system cannot do everything, decide in advance what to give up. This is graceful degradation: the service gets simpler and keeps its most important functions. Page 3 gave examples: a page without recommendations, a shop without reviews. UDS uses an aircraft that loses a non-critical system and still lands.
Plan it as a ladder, from most to least important:
| Level | What is dropped |
|---|---|
| 1 | Nothing: all features on |
| 2 | Recommendations, "recently viewed" and other extras |
| 3 | Live stock counts (show a cached value) and exact search ranking |
| 4 | Browsing is read-only. Only checkout and login work |
| 5 | A static page with a message |
The ladder is a design aid, not a book table. It makes one point: each rung should be chosen before the incident, and switched by a rule or a flag and not by guesswork at 3 a.m.
Deadlines. This part is not from the books used here. It is common practice. A request that has a user waiting should carry a deadline: the time by which the answer is no longer useful. Each service in the chain passes on the time that is left. If the budget is already spent, a service should drop the work and not start it. Otherwise services in the chain work on requests whose caller has already given up, which wastes capacity during overload.
A worked example (made up). A user request has 3 seconds in total. The gateway uses 0.2 s and passes 2.8 s to the order service. That uses 0.5 s and passes 2.3 s to stock. If stock sees 0.1 s left, it can reject at once with "deadline exceeded", and does not start a query that cannot finish.
Read it as
Shed what the user is least likely to miss, as early as possible, and without doing any of its work first.
Check yourself: 1. Why must the degradation order be chosen in advance? 2. What should a service do when a request arrives with no time left? 3. Why does working on abandoned requests make overload worse?