Skip to main content

Partial Failure

1. Executive Summary​

Partial failure is the defining characteristic that separates distributed systems from single-machine programs. In a distributed system, some components can fail while others continue operating — a database replica may crash, a network link may drop, or a service may become slow without crashing. The rest of the system must detect ambiguity, preserve safety where possible, and degrade gracefully rather than collapse entirely.

This chapter explains why partial failure is inevitable, how it manifests in production, and what architectural patterns mitigate its impact. You will learn to reason about failure detection limits (including the FLP impossibility result), map failures to the Fallacies of Distributed Computing, and design systems that assume failure as the normal case rather than the exception.

Key takeaway: Every remote interaction is an unreliable message across an unreliable medium. Architecture that treats successful RPC calls as guaranteed is architecture that will fail in production.


2. Why This Topic Matters​

Principal architects are evaluated on whether they design systems that survive real-world failure — not idealized LAN conditions. Interview panels at senior levels probe whether you understand that:

  • A "healthy" load balancer can route traffic to an unhealthy backend.
  • A timeout does not tell you whether work completed.
  • Retries can convert a localized fault into a system-wide outage.
  • Consensus algorithms exist precisely because nodes fail independently.

Partial failure is the root cause behind most distributed-systems complexity: replication, consensus, idempotency keys, circuit breakers, eventual consistency, and chaos engineering all exist because components fail independently. If you cannot articulate partial failure clearly, you cannot credibly defend tradeoffs in consistency, availability, or latency.

This topic connects directly to Safety and Liveness, Distributed System Models, and every subsequent domain in this curriculum.


3. Problems Being Solved​

Partial failure creates several interrelated problems that every distributed architecture must address:

ProblemDescriptionWhy it is hard
Failure detectionDetermine which nodes are down vs. slowNo perfect detector in asynchronous systems (FLP)
Ambiguous outcomesClient cannot know if a request succeeded after timeoutNetwork may drop the response, not the request
Inconsistent stateReplicas diverge when some writes succeed and others do notNo shared memory; coordination is expensive
Cascading overloadFailed component causes retries that overwhelm survivorsRetry amplification without backpressure
Gray failuresDegraded nodes appear alive but behave incorrectlyHealth checks pass; latency or correctness fails

The goal is not to eliminate failure — that is impossible at scale — but to bound blast radius, preserve invariants under fault, and recover automatically where liveness permits.


4. Assumptions and System Model​

We adopt a standard distributed-system model unless stated otherwise:

  • Processes run on nodes connected by an unreliable network.
  • Crash-stop failures: A node halts and does not resume (simplifying model). Byzantine failures (arbitrary/malicious behavior) are noted but not assumed unless specified.
  • Asynchronous timing: Message delays are unbounded; local clocks are not trusted for correctness.
  • No shared memory: Coordination requires message passing.

Under this model, the FLP impossibility result (Fischer, Lynch, and Paterson, 1985) proves that in a fully asynchronous system with even one crash failure, no deterministic consensus algorithm can guarantee both safety (never decide wrongly) and liveness (eventually decide) in all executions. This is not a engineering inconvenience — it is a fundamental limit. Production systems work around it by weakening assumptions (partial synchrony, failure detectors with timeouts, randomized algorithms) or accepting bounded inconsistency.

Assumption to state explicitly in designs: "We assume crash-stop failures and an asynchronous network unless we introduce leases, epochs, or synchronized clocks for a specific subsystem."


5. Essential Terminology​

TermDefinition
Partial failureSome components fail while others continue; the system is neither fully up nor fully down
Total failureAll replicas or all paths fail; often easier to detect
Fail-fastDetect failure quickly and return an error rather than block indefinitely
Fail-silentA crashed node stops sending messages (crash-stop model)
Gray failureA component is reachable but degraded; may violate SLOs without triggering health checks
Split brainPartitioned nodes each believe they are authoritative, risking conflicting writes
Blast radiusScope of impact when a component fails
At-least-once deliveryMessage or operation may be delivered more than once; requires idempotency
Exactly-once semanticsAchieved in practice via idempotent operations + deduplication, not pure network magic
BackpressureSignaling upstream to slow ingestion when downstream is overloaded
BulkheadIsolating resource pools so one tenant or dependency cannot exhaust shared capacity

6. Core Mechanism​

Partial failure propagates through dependency chains. A client calls Service A, which calls Services B and C, which each call a database. Any link in this chain can fail independently:

Explanation: Service B is shown as failed (red). Service A may still be running but cannot complete the request. The client may see a timeout even though Service C and the database are healthy. The failure boundary is per link, not per request tree.

The core mechanism for coping with partial failure is defensive composition:

  1. Timeouts on every outbound call — bound wait time, but introduce ambiguity.
  2. Retries with jitter — recover transient faults; risk amplification.
  3. Circuit breakers — stop calling a known-bad dependency.
  4. Idempotency — make retries safe.
  5. Bulkheads and quotas — limit concurrent calls per dependency.
  6. Graceful degradation — serve reduced functionality when dependencies fail.
  7. Reconciliation — background jobs fix inconsistent state after ambiguous operations.

No single mechanism is sufficient. The architect's job is to compose them with explicit tradeoffs.


7. Step-by-Step Walkthrough​

Consider a payment service charging a card via an external payment gateway.

Step 1 — Happy path. Client sends POST /charge with an idempotency key. Payment service calls the gateway, receives success, writes to the ledger, returns 200 OK.

Step 2 — Gateway slow, not down. Payment service's outbound timeout fires at 30 seconds. The client receives 504 Gateway Timeout. Unknown state: the gateway may have charged the card but the response was lost.

Step 3 — Client retries with the same idempotency key. Payment service checks its idempotency store: no record of success. It calls the gateway again.

Step 4 — Gateway deduplicates by idempotency key (if supported) or payment service queries gateway status before re-charging.

Step 5 — Reconciliation job runs hourly, comparing ledger entries against gateway settlement reports to catch any drift.

Explanation: The sequence diagram shows why timeouts alone are insufficient. The payment service must reconcile ambiguous outcomes through status queries, idempotency, and background reconciliation — not blind retries.


8. Invariants and Guarantees​

When reasoning about partial failure, separate safety and liveness properties (see Safety and Liveness):

PropertyUnder partial failureTypical guarantee
SafetyBad things never happenNo double charge; no lost committed writes
LivenessGood things eventually happenRequests eventually complete or fail clearly
DurabilityCommitted data survives node crashReplicated WAL with quorum ack
AvailabilitySystem responds to requestsMay degrade; may choose CP or AP per partition

What you cannot guarantee in an asynchronous system with crash failures:

  • Perfect failure detection (a slow node is indistinguishable from a dead node until a timeout).
  • Exactly-once delivery over an unreliable network without application-level deduplication.
  • Simultaneous consistency and availability during a network partition (CAP theorem tradeoff space).

What you can guarantee with careful design:

  • At-most-once or at-least-once with idempotency.
  • Bounded staleness for reads from replicas.
  • Quorum intersection for write safety when using majority replication.

State invariants explicitly: "Account balance never goes negative" is a safety invariant. "Every submitted payment is eventually settled or explicitly failed" is a liveness invariant. Partial failure often forces you to sacrifice liveness temporarily to preserve safety.


9. Failure Scenarios​

Scenario 1: Network Partition​

Two data-center zones lose connectivity. Each zone's application tier can still reach its local database replica, but cross-zone replication stalls.

Symptoms: Elevated replication lag; split-brain risk if both sides accept writes; clients in each zone see locally consistent but globally divergent data.

Mitigation: Quorum-based writes requiring majority across zones; fencing tokens to prevent stale leaders from writing; read-your-writes routing to the leader; operator playbook for manual failover with explicit epoch bump.

Interview signal: Candidate distinguishes partition tolerance from partition recovery and names the consistency cost during the partition.

Scenario 2: Slow Node (Gray Failure)​

One of five database replicas develops a disk fault. It responds to pings and passes TCP health checks but read latency grows from 5 ms to 8 seconds.

Symptoms: Tail latency spikes; load balancer continues routing a fraction of traffic to the sick node; p99 latency violates SLO while mean latency looks fine.

Mitigation: Latency-aware load balancing; outlier detection (e.g., eject replicas exceeding peer latency by a factor); active health checks that measure query latency, not just port open; redundant reads with merge (as in Dynamo-style systems).

Interview signal: Candidate mentions that the network is not the only source of partial failure — degraded hardware and GC pauses are equally common.

Scenario 3: Cascading Failure​

A downstream authentication service slows due to a connection pool leak. Upstream services block threads waiting for auth, exhaust their own pools, and fail health checks. The load balancer removes them, concentrating traffic on remaining instances, which also fail.

Symptoms: Correlated failures across seemingly independent services; retry storms; error rate climbs exponentially over minutes.

Mitigation: Timeouts shorter than client patience; circuit breakers; bulkheads isolating auth thread pools; retry budgets (cap retries as a percentage of total traffic); load shedding at the edge; autoscaling on saturation signals, not just CPU.

Explanation: As instances fail health checks, the load balancer shifts traffic to survivors, accelerating overload. The root cause (auth) is a small fraction of the blast radius.


10. Performance Characteristics​

Partial failure dominates tail latency, not mean latency. A single slow dependency in a serial call chain determines end-to-end latency:

If Service A calls B and C serially, and each has independent availability (p), the combined success probability is (p^2). With (p = 0.999) (three nines per service), the chain succeeds only (0.999^2 \approx 0.998) — roughly two nines for the composed path.

For parallel calls with "all must succeed" semantics, the same (p^2) applies. With "any one suffices" semantics, combined availability is (1 - (1-p)^2).

Tail latency compounding: If a request fans out to 100 shards and you need responses from all shards, the probability that at least one shard is slow at the p99 level approaches certainty at scale. This is why large-scale systems use hedged requests, speculative retry, or relaxed consistency — not because mean latency is high, but because tail events dominate at scale.

Do not cite specific production p99 numbers unless sourced. The structural argument — serial dependencies multiply failure probability; fan-out amplifies tail latency — holds regardless of constants.


11. Scalability Limits​

Partial failure becomes harder as:

  • Fan-out grows: More shards, more chances for one straggler.
  • Dependency depth grows: More hops, more timeout ambiguity.
  • Multi-tenancy increases: Noisy neighbors cause gray failures for others.
  • Geographic distribution increases: Partitions and latency variance rise.

Scaling breakpoints:

Scale signalFailure modeArchitectural response
10+ synchronous hopsTimeout stackingAsync workflows, sagas, event-driven
100+ shard fan-outStraggler dominanceScatter-gather with deadline propagation
Multi-regionPartition frequencyCRDTs, conflict resolution, active-passive
1000+ microservicesCascading failureBulkheads, mesh-level outlier detection

The limit is not throughput alone — it is the probability that at least one component is in a failed or degraded state at any moment, which approaches 1 as component count grows (related to the "large numbers" argument in site reliability practice).


12. Operational Considerations​

Detection: Metrics on error rate, latency histograms, saturation, and useful health checks. Synthetic probes that exercise critical paths. Distributed tracing to locate which hop failed.

Response: Runbooks for partition, single-node degradation, and cascading failure. Pre-defined degradation modes (disable recommendations, serve cached catalog). Feature flags to shed load.

Recovery: Verify data consistency after failover. Replay from durable logs. Post-incident review distinguishing root cause from amplifying factors.

Chaos engineering: Deliberately inject latency, packet loss, and process kills in staging (and carefully in production) to validate assumptions. A system that has never been tested under partial failure will fail under partial failure.

On-call reality: Alerts should fire on user-visible SLO burn, not only on instance death. Gray failures are the leading cause of "the dashboards look fine but customers are angry."


13. Security Considerations​

Partial failure intersects security:

  • Fail-open vs. fail-closed: When the auth service is unreachable, should the API deny all traffic (secure, unavailable) or allow cached credentials (available, risky)? This is a product and compliance decision, not purely technical.
  • Retry amplification as DoS: An attacker triggering expensive retries can overload a system more effectively than direct requests. Rate limiting and retry budgets apply to adversarial as well as benign clients.
  • Split-brain and fencing: A stale primary that resumes writing after a partition can corrupt data. Fencing tokens or epoch numbers prevent zombie leaders from committing.
  • Information leakage: Detailed error messages from failed internal services can reveal topology. Return generic errors to clients; log specifics internally.

14. Cost Considerations​

Fault tolerance has direct cost:

  • Replication: N replicas mean roughly N times storage and write-path cost (often reduced by quorum).
  • Multi-AZ / multi-region: Cross-zone traffic charges and idle standby capacity.
  • Idempotency stores: Additional storage and lookup latency per mutating request.
  • Over-provisioning for burst: Capacity headroom to absorb retry storms without saturation.

Cost-aware resilience: Not every path needs three-nines availability. Tier services by criticality; use async processing for non-critical paths; accept eventual consistency where the business allows. The principal architect articulates which failures are worth preventing at what cost.


15. Production Implementations​

Patterns seen in production systems (implementation choices, not universal law):

PatternWhere it appearsRole in partial failure
Circuit breakerNetflix Hystrix, resilience4j, service meshesStop calling failing dependencies
Bulkhead thread poolsHystrix, Envoy connection limitsIsolate failure per dependency
Idempotency keysStripe API, AWS S3 conditional writesSafe retries after timeout
Quorum reads/writesCassandra, DynamoDB, etcdSurvive minority replica failure
Leader election + fencingKafka, ZooKeeper, Raft implementationsSingle writer during normal operation
Outlier detectiongRPC, EnvoyEject slow endpoints
Durable execution / sagasTemporal, CadenceRecover multi-step workflows after crash

Study one system's postmortem (see Production Failures) after reading this chapter to connect theory to incident narratives.


16. Alternatives and Tradeoffs​

ApproachProsConsWhen to use
Synchronous RPC chainSimple mental modelFailure multiplies; tail latency stacksLow hop count, strong consistency needed
Async messagingDecouples failure domainsComplexity, eventual consistencyHigh throughput, fault isolation
Cache fallbackMaintains availabilityStale dataRead-heavy, tolerable staleness
Active-active multi-regionLow failover timeConflict resolution, partition riskGlobal latency requirements
Active-passive failoverSimpler consistency storyFailover time, idle costRPO/RTO allow minutes of recovery
Chaos testingValidates real behaviorRisk if poorly scopedMature ops culture

There is no "most resilient" architecture — only architecture matched to failure modes you prioritize and SLOs you commit to.


17. Common Misconceptions​

  1. "We'll use retries, so failures are handled." — Retries without idempotency cause duplicates; retries without budgets cause cascades.

  2. "Health checks prove a service is healthy." — They prove a port responded. Gray failures violate SLOs while passing checks.

  3. "Timeouts mean the operation failed." — Timeouts mean you do not know. The operation may have succeeded.

  4. "The network is reliable." — First fallacy of distributed computing (Deutsch et al.). Packets drop, switches fail, DNS lies.

  5. "More replicas always mean more availability." — Without correct quorum and fencing, more replicas can mean more split-brain risk.

  6. "Microservices isolate failure." — They isolate deployment; they couple failure if synchronously chained without defensive patterns.

  7. "FLP means consensus is impossible." — FLP applies to deterministic algorithms in fully asynchronous systems. Real systems use timeouts (partial synchrony), randomization, or accept brief unavailability.


18. Principal Architect Perspective​

At principal level, interviewers want more than pattern names. They want:

  • Explicit system-model statements when proposing designs.
  • Blast-radius analysis for each dependency.
  • Business alignment: "We accept duplicate charges are worse than delayed charges, so we fail closed and reconcile."
  • Organizational design: Who owns the SLO for shared dependencies? How do teams coordinate timeout values across call chains?
  • Evolution path: How does the design degrade at 10x traffic or during a regional outage?

Frame partial failure as a design constraint, not an operational afterthought. The best architects design APIs, data models, and deployment boundaries so that failure is contained, observable, and recoverable by default.

Red flags in architecture reviews: Unbounded retries, no idempotency on mutations, shared connection pools across tenants, synchronous chains deeper than three hops without async escape hatches, no defined degradation mode.


19. Architecture Review Exercise​

Scenario: A global e-commerce platform serves product pages by synchronously calling Inventory, Pricing, Recommendations, and Reviews services. p99 page load SLO is 500 ms. During a sale event, the Recommendations team deploys a change that increases latency from 50 ms to 2 seconds. Page error rate spikes.

Your task:

  1. Draw the dependency graph and identify failure propagation paths.
  2. List three architectural changes that would reduce blast radius (with tradeoffs).
  3. Define degradation behavior when Recommendations exceeds 200 ms.
  4. Specify metrics and alerts that would have caught this before customers.
  5. State safety and liveness properties for the product page.

Evaluation rubric:

ScoreCriteria
StrongNames cascading failure, proposes timeout/deadline propagation, circuit breaker or async cache for recommendations, defines SLO-based alerts on burn rate
AdequateMentions caching and timeouts but no idempotency or organizational ownership
Weak"Scale up Recommendations" without addressing synchronous coupling

20. Whiteboard Explanation​

60-second version:

"In a distributed system, components fail independently — that's partial failure. Unlike a single program that crashes entirely, one microservice can die while others keep running. The hard part is ambiguity: after a timeout, you don't know if the request succeeded. FLP proves you can't even solve consensus perfectly in an async system with crashes. So we design with timeouts, idempotency, circuit breakers, and quorums. We assume failure is normal and bound the blast radius."

Whiteboard sketch:

[Client] --timeout?--> [Service] --retry?--> [DB primary]
| |
circuit open [DB replica - stale]

Label: failure boundaries on every arrow; "unknown" zone after timeout.


21. Interview Questions​

  1. What is partial failure, and how does it differ from failure in a monolithic application?

  2. Why does a timeout not prove that an operation failed?

  3. Explain the FLP impossibility result and its practical implications for system design.

  4. Name three of the Fallacies of Distributed Computing and describe how each leads to production incidents.

  5. What is a gray failure? How would you detect and mitigate it?

  6. How can retries cause a cascading failure? What defenses do you use?

  7. Design an idempotent payment API that handles duplicate client retries safely.

  8. Compare fail-open and fail-closed when an authentication dependency is unavailable.

  9. A network partition splits your cluster into two halves. What happens if both sides continue accepting writes?

  10. How does partial failure relate to the CAP theorem?

  11. You have a 10-service synchronous chain. How do you reason about end-to-end availability?

  12. What is the difference between at-least-once, at-most-once, and exactly-once delivery?

Expected answer signals: Independent failure of components; timeout ambiguity; FLP and partial synchrony workarounds; fallacies (network reliable, latency zero, bandwidth infinite); idempotency keys; circuit breakers and bulkheads; quorum and fencing; safety vs. liveness tradeoff under partition.

Red flags: "We use Kubernetes so it handles failures"; "exactly-once is built into Kafka" without nuance; no mention of ambiguous outcomes.


22. Interview Follow-Ups​

  1. After Q3 (FLP): "How does Raft get around FLP?" — Expect: partial synchrony via election timeouts; leader-based approach sacrifices availability during partition to preserve safety.

  2. After Q6 (cascading failure): "How do you set retry budget vs. user-facing timeout?" — Expect: retries must fit inside client deadline; jittered exponential backoff; cap retry percentage of total RPS.

  3. After Q7 (idempotent payment): "What if the idempotency store is down?" — Expect: fail closed on mutations; queue for later; distinguish read vs. write path.

  4. After Q9 (partition): "How does Amazon Dynamo handle partition tolerance?" — Expect: eventual consistency, vector clocks or last-writer-wins, conflict resolution; availability during partition at consistency cost.

  5. After Q10 (CAP): "Is CAP still useful?" — Expect: useful as a forcing function for partition behavior; limited for multi-dimensional tradeoffs; PACELC extension.

  6. Principal-level: "How do you get 20 teams to adopt consistent timeout and retry policies?" — Expect: platform standards, service mesh defaults, SLO contracts, automated linting of client configs, incident-driven adoption.


22A. Production Low-Level Design (Interview + Game Day)​

Design a call path that treats timeout = unknown. Align with the Production LLD and Game Day Standard.

Control vs data plane​

PlaneComponentsRole
ControlMesh/timeouts, circuit breakers, retry budgets, feature flagsBound ambiguity blast radius
DataIdempotency store, status APIs, reconcile jobsMake mutations safe under unknown

Happy-path + ambiguous outcome​

Step-by-step flow:

StepActionNotes
1–2Propagate deadlineNested hops shrink budget
3Timeout firesNot proof of failure
4–6Idempotent retry or statusBlind new-key retry is unsafe

Failure checklist​

  • Retry budget ≤ ~10% traffic; jittered backoff.
  • Circuit open → degrade (cached / omit non-critical).
  • Money: fail closed + reconcile, never guess.

One SLO​

Client-facing availability with correctness: success rate where success excludes duplicate side effects; alert on retry amplification and breaker open rate.


22B. Game Day Playbooks​

#DrillInjectDetectMitigateVerify
GD-1Downstream hang past client timeouttoxiproxy delay > timeoutClient error↑, completed writes still happenIdempotent retry / statusNo duplicate rows
GD-2Retry stormKill dependency briefly; clients retry unboundedRetry RPS↑, cascadeCap budget + open breakerDependency recovers; error budget
GD-3Gray failureSlow 10% instancesTail latency / SLO burnOutlier ejectp99 recovers

GD-1 — Timeout ambiguity​

23. Strong Answer Example​

Question: "A client times out calling your service. What happened, and what should happen next?"

Answer this as a 45-minute design discussion using the PRACTICE framework. Below is how a strong student sounds aloud—timeout = unknown, not "the service crashed."

PRACTICE interview answer map for client timeout under partial failure

Figure A: PRACTICE map — Problem → Requirements → Assumptions → Capacity → Topology → Invariants → Constraints → Evolution.


Student interview script (PRACTICE)​

P — Problem framing​

"A client timeout means we exceeded a deadline waiting for a response. It does not mean the operation failed. Under partial failure, that single fact is ambiguous:

  1. Request never arrived
  2. Server still working (slow)
  3. Server finished, response lost
  4. Server crashed mid-flight

We cannot tell which from the client's chair—slow and dead look the same until a timeout (FLP-style intuition in async networks).

Short answer: Treat the outcome as unknown. Next step depends on whether the call was mutating: retry only with idempotency (or query status); never blind-retry money paths; bound retries inside a deadline; open a circuit if the dependency is sick."

R — Requirements​

GoalAfter timeout
Safety (payments, inventory)No duplicate side effect
Liveness (eventually succeed)Bounded retries / reconcile
User UXClear "processing / unknown" vs false failure
Protect the fleetRetry budgets; no stampede

"I'd ask: was this a GET or a charge? What's the user-facing deadline?"

A — Assumptions (state aloud)​

AssumptionWhy it matters
Async / partial-sync networkTimeout ≠ proof of failure
At-least-once if we retryNeed idempotency
Downstream may have succeededStatus query / idempotency store
Client has a deadlineNested timeouts must fit inside it
Orchestration ≠ correctnessK8s restarts don't fix duplicate charges

"I'd say: I'm designing for unknown outcome, not for 'crash confirmed.'"

C — Capacity (retry math)​

Blind retries × many clients → thundering herd / cascade
Retry budget → e.g. ≤10% of traffic is retries; exponential backoff + jitter
Deadline propagation → remaining time shrinks down the call chain
Circuit breaker → stop calling a hot dependency; degrade

"If the page SLO is 500 ms, my internal call can't each burn 500 ms plus three retries."

T — Topology (draw this)​

Timeout is ambiguous — three possible worlds

Figure B: After timeout, request may be lost, in flight, or completed with a lost response—client cannot distinguish.

What should happen next after timeout

Figure C: Don't assume failure; idempotent retry or status check; backoff; circuit-break; reconcile money.

Call typeWhat should happen next
Read (GET)Usually safe to retry; watch cache stampede
Idempotent mutateRetry with same idempotency key
Non-idempotent mutateDon't blind retry—status API, compensate, or mark uncertain + reconcile
Dependency sickCircuit open → degrade / fail fast
PaymentFail closed on ambiguity; async reconcile with gateway

I — Invariants (safety)​

"Non-negotiable:

  1. Timeout ⇒ unknown, not failed.
  2. Mutating retries require the same idempotency key (or equivalent dedupe).
  3. Deadlines propagate—child calls get remaining budget.
  4. Retry budgets prevent cascades.
  5. Money paths prefer safety—reconcile rather than guess.
  6. Replicas / K8s don't remove ambiguity by themselves."

C — Constraints (second C)​

ConstraintDesign response
Cannot distinguish slow vs deadTimeouts + retries with idempotency; failure detectors are approximate
Lost success responseIdempotency store returns prior result
Nested microservicesEnd-to-end deadline; fewer sync hops
Idempotency store downFail closed on mutations
User refreshes / double-clicksClient-generated idempotency key

E — Evolution (prove it)​

Phased delivery:

PhaseDeliverable
M1Document timeout ambiguity in API guidelines
M2Idempotency keys on all mutating APIs
M3Deadline propagation + retry policy with jitter
M4Circuit breakers + degradation modes
M5Chaos: delay responses past client timeout; assert no double side effects
M6Payment reconcile job against provider settlements

Failure modes:

FailureMitigation
"Service crashed—retry"Teach unknown outcome
Retry without keyDouble charge / double ship
Unbounded retriesBudget + breaker
"K8s will fix it"App-level correctness

Observability: timeout rate, retry rate, idempotent hit rate, downstream p99 vs client timeout, circuit state, reconcile deltas.


Closing line (interview)​

"So when a client times out, something partial happened and the outcome is unknown—not proven failed. Next: if it's a mutation, retry only with the same idempotency key or query status; fit retries inside a propagated deadline with backoff and a retry budget; if the dependency is sick, circuit-break and degrade. For payments, I fail closed and reconcile—safety over guessing."

Scoring signals​

StrongWeak / red flag
Timeout = unknown / ambiguous"Service crashed"
Idempotent retry or status checkBlind retry
Deadline + retry budget + breakerUnbounded retries
Money: fail closed + reconcile"K8s / 3 replicas fixes it"
Nested timeout mathEach hop uses full SLO

Compact outline (if time-boxed to 2 minutes)​

"Timeout means unknown, not failed. Retry mutations only with same idempotency key or check status. Propagate deadlines, backoff with budget, circuit-break when sick. Payments: fail closed and reconcile."

24. Weak Answer Example​

Question: "A client times out calling your service. What happened, and what should happen next?"

"The service probably crashed. The client should retry a few times. We have Kubernetes, so it will restart the pod automatically. We also have three replicas so we're highly available."

Why weak / red flags: Assumes a failure mode without acknowledging ambiguity; retries without idempotency; conflates orchestration with application correctness; no safety, circuit breaking, or reconciliation—replicas don't fix timeout semantics.


25. Hands-On Exercise​

Exercise: Failure Injection and Observation

Prerequisites: Docker, a simple HTTP service (provided or self-written), toxiproxy or Linux tc netem.

Steps:

  1. Deploy a three-tier app: client → api → db (use any lightweight stack).
  2. Inject 500 ms latency on the api → db link. Measure p50 and p99 end-to-end latency.
  3. Add a 2-second client timeout. Observe error rate vs. actual completed writes.
  4. Implement idempotency keys on a POST endpoint. Retry 10 times; verify exactly one row created.
  5. Add a circuit breaker. Sustain db latency until breaker opens. Observe fail-fast behavior and recovery.
  6. Document: Which fallacies of distributed computing did you observe?

Success criteria: Written summary of ambiguous outcomes observed, one diagram of failure propagation, and a recommendation for timeout values based on measured latency percentiles (not invented constants).


26. Knowledge Check​

  1. True or false: A failed health check proves a node is down. (False — inverse is not guaranteed either; gray failures pass checks.)

  2. What property does FLP say is impossible in a fully asynchronous crash-stop system? (Deterministic consensus with both safety and liveness.)

  3. Why must mutating retries use idempotency keys? (Timeout does not imply failure; duplicate execution without idempotency violates safety.)

  4. Name two mechanisms that reduce cascading failure. (Circuit breaker, bulkhead, retry budget, load shedding, backpressure — any two.)

  5. During a partition, can a CP system and an AP system both remain fully available? (CP sacrifices availability; AP sacrifices strong consistency — per CAP framing.)

  6. What is the difference between crash-stop and Byzantine failure? (Crash-stop halts; Byzantine may send arbitrary/wrong messages.)

  7. If two independent services each have 99.9% availability and a request needs both serially, what is approximate combined availability? (≈ 99.8% or 0.999².)


27. Flashcards​

FrontBack
Partial failureSome components fail while others continue operating
FLP impossibilityNo deterministic consensus in fully async system with one crash
Gray failureNode reachable but degraded; hard to detect via simple health checks
Timeout ambiguityAfter timeout, outcome may be success, failure, or unknown
Idempotency keyClient-supplied token ensuring retries do not duplicate side effects
Circuit breakerStops calls to failing dependency to prevent cascade
BulkheadIsolated resource pool limiting blast radius per dependency
Split brainPartitioned nodes both act as authority, risking divergence
Fail-open vs. fail-closedAllow traffic vs. deny when dependency fails — security/availability tradeoff
Retry stormAmplified load from many clients retrying simultaneously
Fallacy: network is reliablePackets drop; designs must assume loss and partition
QuorumMinimum replicas that must agree to commit a write

28. Cheat Sheet​

Assume: Every remote call can fail, hang, or succeed with a lost response.

Always: Timeouts · Idempotency on mutations · Deadline propagation · Metrics on tail latency

Contain: Circuit breakers · Bulkheads · Retry budgets with jitter · Load shedding

Recover: Reconciliation jobs · Durable logs · Quorum replication · Fencing stale leaders

Detect: SLO-based alerts · Outlier ejection · Synthetic probes · Distributed tracing

Articulate: Safety vs. liveness · System model · Blast radius · Degradation mode

FLP takeaway: Perfect failure detection is impossible; use timeouts and accept tradeoffs.

Fallacies reminder: Network not reliable · Latency not zero · Bandwidth not infinite · Topology changes · Transport not secure.



30. References​

Primary sources​

Books and practitioner texts​

  • Kleppmann, M. (2017). Designing Data-Intensive Applications. O'Reilly — Chapters on replication, consistency, and fault tolerance.
  • Burns, B., & Beda, J. (2019). Kubernetes: Up and Running. O'Reilly — Orchestration does not replace application-level failure handling.
  • Beyer, B., et al. (2016). Site Reliability Engineering. O'Reilly — Cascading failure, overload management, and SLO practice.
  • Hohpe, G., & Woolf, B. (2003). Enterprise Integration Patterns. Addison-Wesley — Messaging patterns for failure decoupling.

Production experience and gray failures​

Distinguish guarantee types​

Claim typeExample in this chapter
Formal guaranteeFLP impossibility; quorum intersection for write safety
Implementation choiceCircuit breakers in Hystrix/Envoy; Stripe idempotency keys
Operational practiceChaos engineering; SLO burn-rate alerting

TODO: Add formal entries to references/papers.yaml for FLP and Byzantine Generals when bibliography curation phase begins.