Quick revision
The short answer
We rank the four features by how essential they are: price is essential, stock is useful, and reviews and recommendations are optional. Optional sections are hidden or replaced by a placeholder when their service fails or times out, stock falls back to a recent cached value with a note or to a check availability message, and if the price cannot be determined reliably we never show a guessed price, so we fail that part of the page or at least disable the purchase action. Every fallback is counted, because silent fallbacks can hide long outages.
What to remember
In this answer, we designed graceful degradation for a product page fed by four services. We ranked price as essential, stock as useful, and reviews and recommendations as optional, called all four in parallel with per-section timeouts and fallbacks, hid optional sections on failure, showed stock from a recent labelled cache or a neutral message, and refused to show a price we could not trust, disabling the purchase instead. Fallback metrics make sure degraded mode never goes unnoticed.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
We rank the four features by how essential they are: price is essential, stock is useful, and reviews and recommendations are optional. Optional sections are hidden or replaced by a placeholder when their service fails or times out, stock falls back to a recent cached value with a note or to a check availability message, and if the price cannot be determined reliably we never show a guessed price, so we fail that part of the page or at least disable the purchase action. Every fallback is counted, because silent fallbacks can hide long outages.
Why this question is asked
A product page is a good example of composition: one page, four services, each with its own failure modes. If we treat every dependency as essential, the page is only as available as the product of all four, and if one has 99.5 percent availability, the page inherits its outages. If we treat everything as optional, we may sell at a wrong price. Interviewers ask this to see whether we can make that ranking explicit and implement it cleanly. In this answer, we will rank the features, decide the behaviour for each failure, build the page with parallel calls and per-section timeouts, and make the degraded states visible.
1A Quick Recap: Graceful Degradation
Graceful degradation means that when part of a system fails, the rest keeps working with reduced functionality instead of failing completely. For a page built from several services, it means deciding in advance, for each piece, what the page does when that piece is missing or slow.
The availability arithmetic shows why. If the page requires all four services and each is available 99.5 percent of the time, independently, the page is available about 98 percent of the time, which is roughly seven days of failure a year. If only the price service is required, the page is available about 99.5 percent of the time.
2Ranking the Features
We rank the sections with the product owner, not alone, because it is a business decision. Price is essential: we cannot sell without a correct price, and a wrong one causes legal and financial trouble. Stock is useful: it helps the customer decide, and it matters at checkout, but the final check happens when the order is placed. Reviews and recommendations are optional: the page still does its main job, letting the customer understand and buy the product, without them.
That ranking directly gives each section a failure behaviour and a timeout. Optional sections get short timeouts, because they should never hold up the page; essential ones get a bit more time, because without them the page is useless.
| Section | Rank | Timeout | On failure or timeout |
|---|---|---|---|
| Price | Essential | 400 ms | no guessed price: show unavailable, disable Add to cart |
| Stock | Useful | 200 ms | cached value with a note, or 'check availability' |
| Reviews | Optional | 150 ms | hide the section or show a placeholder |
| Recommendations | Optional | 150 ms | hide the section |
3Building the Page With Parallel Calls and Per-Section Fallbacks
The page service calls all four dependencies in parallel, so the total wait is the slowest essential call, not the sum. Each call has its own timeout and its own fallback, and optional ones complete with an empty result rather than an exception.
Notice that orTimeout and completeOnTimeout only stop us waiting; the underlying HTTP call should also have its own read timeout so threads and connections are released. With virtual threads, the executor can be one virtual thread per task, which suits this fan-out well. Each call would normally also sit behind a circuit breaker, so a dependency that is down fails instantly instead of costing its timeout on every page view.
4Stock: Stale but Honest
Stock is the interesting middle case. Showing nothing loses useful information, but showing a cached value as if it were live might promise an item that sold out a minute ago. So we show a cached value only if it is recent, here less than 10 minutes old, and label it with its time. If there is no recent value, we show a neutral check availability message. Whatever the page says, the order service checks stock again when the order is placed, so a stale value can disappoint, but cannot oversell.
5Price: When to Fail Instead of Degrade
Price is where degradation stops. A cached price might be wrong because of a sale that just started or ended, and a default price is simply invented. Showing either as the price invites customers to buy at a figure we cannot honour. So if the pricing service cannot give a reliable answer within its timeout, the page shows that the price is currently unavailable and disables the purchase action, or, depending on the business, returns an error page for the product.
There is a narrow exception: some businesses keep a signed, short-lived price that the pricing service published recently, and accept it for display while the checkout re-prices authoritatively. That is a product decision with legal input, not a default.
6Making Degraded Mode Visible
Every fallback increments a metric tagged with the section, such as page.fallback with section=reviews, and the page's response carries a header or log field listing the degraded sections. Dashboards show the fallback rate per section, and alerts fire when it stays above a threshold, for example 5 percent for 10 minutes. Without this, a reviews service could be down for a week while the page looks fine and nobody notices the lost conversions.
- Call four services in paralleleach with its own timeout
- Price reliable?YesShow price, enable purchaseNoShow unavailable, disable purchase
- Stock answered?YesShow live stockNoRecent cache with time, or check availability
- Reviews and recommendationsshow, or hide on failure
- Count every fallbackalert if a section degrades for long
5 steps in order. Play them, or step through them one at a time.
7Follow-up questions
Why not render the optional sections in the browser instead?
That is a good option: the server renders the essential parts and the browser loads reviews and recommendations separately, so their failures cannot slow the main response at all. It moves the degradation logic into the front end, which must then handle each section's failure gracefully.
What timeout should the whole page have?
Slightly more than the slowest essential call's timeout plus our own processing, here roughly 500 ms. Optional calls must have shorter timeouts so they can never extend it.
How do you test these behaviours?
In integration tests we stub each service to fail or be slow, one at a time, and assert the page's result: reviews hidden, stock stale with its time, price unavailable with purchase disabled. In game days we switch a real dependency off in a test environment and watch the page and the fallback metrics.
8Conclusion
In this answer, we designed graceful degradation for a product page fed by four services. We ranked price as essential, stock as useful, and reviews and recommendations as optional, called all four in parallel with per-section timeouts and fallbacks, hid optional sections on failure, showed stock from a recent labelled cache or a neutral message, and refused to show a price we could not trust, disabling the purchase instead. Fallback metrics make sure degraded mode never goes unnoticed.
Open with
I would start by ranking the sections with the product owner, because it is a business decision. Price is essential, stock is useful, reviews and recommendations are optional.
Then, if they want more
That ranking drives everything else. The page service calls all four in parallel, so the wait is the slowest essential call, each with its own timeout: short ones like 150 milliseconds for the optional sections, a bit more for price. Each call also sits behind a circuit breaker so a dead service fails instantly.
For optional sections, failure or timeout simply hides the section or shows a placeholder; the page still does its job.
For stock, I would show a cached value only if it is recent, say under ten minutes, labelled with its time, or otherwise a neutral check availability message, and the order service checks stock again at checkout anyway, so we cannot oversell. Price is where I would not degrade.
A cached or default price could be wrong, and showing it invites customers to buy at a price we cannot honour, so if pricing fails, the page says the price is currently unavailable and disables Add to cart, or fails the page if the business prefers.
Finally, every fallback increments a metric per section, with an alert when a section stays degraded, because silent fallbacks can hide a service being down for days while revenue quietly drops.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Cloud documentation, Resilience4j documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Design graceful degradation for a product page that shows price, stock, reviews and...": https://scrivio-interview-library.netlify.app/spring-boot/resilience/6d02dec586/