04 / 25 · Reliability
Fault tolerance
Fault tolerance is the ability to keep required behavior correct when specified components fail. Name the failure you tolerate and the degraded behavior you allow. It is not a claim of immunity to every possible fault.
What you will practise
- Name the tolerated fault
- choose safe degradation
- handle unknown write outcomes
Before you start: Timeout, request deadline and side effect.
About 4 minutes · offline-generated English female narration · captions included. Diagrams are conceptual; timings are illustrative.
Download MP4CaptionsListen without the video
Download audioChapters and full transcript
Let us understand fault tolerance. A bicycle with a spare light can still be seen when the main light breaks. But that spare light cannot fix a broken frame. A useful plan names the fault and the remaining safe behavior. A website might keep showing events when its recommendation feature fails while refusing to sell a seat it cannot confirm. Fault tolerance is the ability to keep required behavior correct when specified components fail. Name the failure you tolerate and the degraded behavior you allow. It is not a claim of immunity to every possible fault.
Follow the normal path. The event page needs correct booking information, but recommendations are optional. Give these paths different deadlines and resource budgets. Recommendations stop responding. Without a boundary, waiting calls can consume all connections or workers and affect otherwise healthy operations. A slow optional recommendation service should not use every request thread and prevent checkout. SeatSpot isolates optional work and keeps a safe core path instead of treating every dependency as equally critical.
Now change one condition. The timeout guard ends waiting for optional work. This protects local resources but does not prove a remote write was cancelled or never happened. A common misunderstanding is this: A timeout means the remote action did not happen. A timeout describes your observation, not the remote side effect. Think about this. A payment call times out. Is it safe to retry with a fresh order ID? Pause the video and make your prediction. No. The first charge may have succeeded. Reuse a stable idempotency identity and reconcile the unknown outcome.
Let us reason with a concrete example. A page fans out to three optional services with an overall 800 ms deadline. One dependency stalls for ten seconds. A 200 ms dependency timeout can preserve some page budget, but sequential calls, retries and rendering time must also fit inside 800 ms. Timeouts are not independent free budgets. Return the essential event page without recommendations; keep seat reservations and payment outcomes authoritative. Isolate resource pools so optional failures cannot consume core capacity. These figures are teaching examples, not production guarantees.
Turn the idea into a design decision. Render the essential page without suggestions. Do not turn an uncertain payment outcome into a success message just to make the page appear healthy. If a retry is appropriate, limit attempts and use backoff with jitter. Preserve one operation identity for side effects so retries do not create duplicate business actions. When you try the practice task, look for this result. Recommendations can be omitted; a confirmed payment must not be invented.
Check your understanding. Inject a slow response and a lost reply in a safe test environment. Verify core capacity and user-visible correctness rather than only testing a clean server shutdown. Here is a challenge. The payment provider times out after you send a charge. What should the booking UI say and what should the backend do? Pause before the answer. Show a pending/unknown outcome rather than success or automatic failure. Reconcile by the same idempotency key/provider reference and update the order state. Avoid issuing a new independent charge. For an interview, bound retries, cancellation and concurrency independently. Say what you would measure, not only which tool you would buy.
Start with an everyday picture
A bicycle with a spare light can still be seen when the main light breaks. But that spare light cannot fix a broken frame. A useful plan names the fault and the remaining safe behavior. A website might keep showing events when its recommendation feature fails while refusing to sell a seat it cannot confirm.
Why SeatSpot needs this
A slow optional recommendation service should not use every request thread and prevent checkout. SeatSpot isolates optional work and keeps a safe core path instead of treating every dependency as equally critical.
Trace one step at a time
Move through the diagram at your pace. Teal paths are active; unavailable components are labelled.
Separate essential work
The event page needs correct booking information, but recommendations are optional. Give these paths different deadlines and resource budgets.
Read all six mechanism steps
Separate essential work
The event page needs correct booking information, but recommendations are optional. Give these paths different deadlines and resource budgets.
An optional call stalls
Recommendations stop responding. Without a boundary, waiting calls can consume all connections or workers and affect otherwise healthy operations.
Enforce a deadline
The timeout guard ends waiting for optional work. This protects local resources but does not prove a remote write was cancelled or never happened.
Degrade honestly
Render the essential page without suggestions. Do not turn an uncertain payment outcome into a success message just to make the page appear healthy.
Bound retries
If a retry is appropriate, limit attempts and use backoff with jitter. Preserve one operation identity for side effects so retries do not create duplicate business actions.
Test partial failure
Inject a slow response and a lost reply in a safe test environment. Verify core capacity and user-visible correctness rather than only testing a clean server shutdown.
Pause and make a prediction
A payment call times out. Is it safe to retry with a fresh order ID?
Correct a common misunderstanding
Claim to question: A timeout means the remote action did not happen.
Better explanation: A timeout describes your observation, not the remote side effect.
Classify failure responses
- List event browsing, recommendations and seat purchase.
- Give each an explicit acceptable degraded behavior.
- Fit dependency timeouts and bounded retries inside one request deadline.
Check what you can explain
This is your self-check, not an automated grade. Try again without the diagram tomorrow.
0 of 3 goals checked. Choose one remaining idea to practise next.
Teach it back
Without looking, explain what this component changes, what it does not solve and what happens if it fails. Use the animation to check your explanation, then switch to Engineering.
Engineering model and trade-offs
Set timeouts based on a request deadline and propagate cancellation where supported. A dependency that never replies should not hold scarce resources forever. Bound concurrency separately for unrelated dependencies to limit the blast radius.
Retries can help transient failures but multiply load. Use a bounded attempt count, backoff and jitter, and only retry operations that are safe or protected by idempotency. A timeout does not prove the remote operation did nothing.
Choose degradation from business semantics. An older event description may be acceptable with a timestamp; inventing a payment result is not. Test partial failures and network timeouts, including a successful write whose response is lost.
Work through an example
A page fans out to three optional services with an overall 800 ms deadline. One dependency stalls for ten seconds.
Reason with the numbers
A 200 ms dependency timeout can preserve some page budget, but sequential calls, retries and rendering time must also fit inside 800 ms. Timeouts are not independent free budgets.
Make a decision
Return the essential event page without recommendations; keep seat reservations and payment outcomes authoritative. Isolate resource pools so optional failures cannot consume core capacity.
Implementation sketch
async function optionalRecommendations(signal: AbortSignal) {
try {
const response = await fetch("/recommendations", {signal});
if (!response.ok) return [];
return await response.json();
} catch { return []; }
}
// Caller supplies a bounded deadline and validates returned data.This illustrates fallback for a genuinely optional read. Do not use an empty success result for a payment or booking operation. Runtime/schema validation and resource isolation are separate responsibilities.
Where this is used
- Keeping optional features from taking down core operations.
- Handling a specified node, network or dependency failure safely.
Common mistakes
- Retrying every error indefinitely.
- Returning fabricated success after a payment timeout.
- Testing only clean disconnections instead of partial failure.
Practise a reasoned answer
Answer aloud or write notes before opening the reference. These prompts teach reasoning and trade-offs; they are not claimed questions from a particular company.
How do retries cause cascading failure?
Choose a practice depth
- Foundation
- Describe a failure and safe fallback.
- Practical
- Bound retries, cancellation and concurrency independently.
- Advanced
- Reason about ambiguous outcomes, reconciliation and isolation of resource pools.
Self-check rubric
- State the required user outcome and the relevant invariant.
- Explain the normal path and one failure path.
- Name a cost or consistency/latency trade-off.
- Say what you would measure or test before trusting it.
For deeper practice, connect this topic to the previous lesson and identify a shared bottleneck. A longer answer is not automatically a better answer.
Try it before viewing the solution
The payment provider times out after you send a charge. What should the booking UI say and what should the backend do?
Check one key idea
Your explanation and interview notes
Saved only in this browser when storage is available. Export a backup from the course page before clearing browser data or moving devices.
Loading your local notes…
Official references and next reading
The explanation, fictional examples and animations are original teaching material. Vendor behavior depends on the specific product/version; use its documentation before deploying.