A product page makes a personalised recommendation call, a reviews call and an inventory call. Under load the recommendation service is the slowest. Rather than failing the page, how would you degrade it?
Sketch your own answer first, then compare it with the one below.
A strong answer
Sort the page by what it cannot do without. Inventory decides whether the buy button works, so it is essential. Reviews and recommendations enrich the page and can be missing.
Under pressure, give the optional calls less. Give them short timeouts that fit inside the page's budget, so a slow recommendation cannot hold the page past its deadline. When the call fails or times out, fill the slot with something cheap, such as a cached list of popular items, or leave the slot out. The user sees a plainer page, quickly, rather than an error or a spinner.
Make the degraded mode a deliberate state and not an accident. A flag or a load signal can switch recommendations to the cached version before they time out, so you stop sending load to the struggling service at all. Mark those calls low criticality, so the recommendation service itself sheds them first and keeps capacity for essential callers.
Test it. Degraded paths are rarely exercised, and the first time they run is usually during an incident. Run them in staging and occasionally in production.
Watch for the cost: a cached fallback can be stale or unfit for that user, so decide how wrong it is allowed to be.
Sources
- Betsy Beyer, Chris Jones, Jennifer Petoff, Niall Richard Murphy (2016). Site Reliability Engineering, chapter 22, Addressing Cascading Failures.