Reliability and Cost Engineering › Failure Testing: Independent vs. Correlated Failure
Language AI HandbookAll chapters Test the dependencies that share a provider, quota, or network path. A failure that appears independent when you test each stage in isolation can affect several stages of the same live request.
Ten independent components with 1% failure probability per component give probability that at least one fails. A shared outage with probability 1% and no other failure mode gives a 1% chance that all ten fail together. Both models average 0.1 failed components per request. Recovery differs because replicas in the same failure domain can fail together.
Use fault injection to test a hypothesis about degraded behavior. Start in a bounded environment. Set your stop conditions and limits on scope before a production experiment, in keeping with the Principles of Chaos Engineering.
A synthetic retrieve-and-generate pipeline tests how a shared outage affects retries and fallback. Compare the same failure schedule with and without an outage gate. Primary and fallback model attempts each have a fixed charge and duration, including on failure. Retrieval on a cache miss is charged only when it succeeds. The outcome counts as good only when it succeeds by one second. For this trial of 20,000 requests, compare with a 99.5% good-request target and a modeled spend limit of $210. The toy policy permits three primary attempts. It still charges for scripted work after the deadline. The one-second threshold scores the result at completion and never cancels an in-flight call or stops the fallback from starting. The gate gets the outage flag as input, which stands in for an already established health signal.
PythonIn [23]Expand
def compound_request(fixture, gate_on, cache, deadline=1.0):
"""Run one simulated retrieval and generation request."""
outage, context, primary_draws, fallback_draw = fixture
latency = 0.015
cost = 0.0
if context not in cache:
latency += 0.07
if outage:
return False, latency, cost, 0, False
cache.add(context)
cost += 0.0002
attempts = 0
if not (gate_on and outage):
for i, draw in enumerate(primary_draws):
if i:
latency += 0.05 * 2 ** (i - 1)
attempts += 1
latency += 0.28
cost += 0.010
if not outage and draw >= 0.02:
return latency <= deadline, latency, cost, attempts, False
# For this scenario both models share the same outage.
latency += 0.22
cost += 0.003
fallback_ok = not outage and fallback_draw >= 0.05
return fallback_ok and latency <= deadline, latency, cost, attempts, TrueUse the same seeded request fixtures in all variants. The baseline has independent attempt failures; the shared-outage variants reuse a fixed 1% outage flag per request. The primary and fallback share this failure domain.
ConsoleOut [24]Expand
Independent attempt failures Good by the one-second deadline: 99.965% p99 latency: 0.625 s Modeled cost: $204.67 Primary attempts per request: 1.019 Fallback used: 0.000% Meets 99.5% SLO and $210 scenario budget: True Shared outage, no gate Good by the one-second deadline: 99.140% p99 latency: 0.695 s Modeled cost: $207.42 Primary attempts per request: 1.031 Fallback used: 0.670% Meets 99.5% SLO and $210 scenario budget: False Shared outage, with gate Good by the one-second deadline: 99.140% p99 latency: 0.625 s Modeled cost: $203.40 Primary attempts per request: 1.011 Fallback used: 0.670% Meets 99.5% SLO and $210 scenario budget: False
An open outage gate stops primary calls, saving attempts. A fallback in the same outage domain still fails. Compare the total spend and the SLI across the policies. Which policy costs more depends on what is billed on failed paths, what gets skipped, and which requests are recovered. An independently available fallback would need its own fault schedule and evaluation.
Exercise the operations and failure classes the service uses, such as timeouts and unusable responses. Include a shared failure mode, set the success and latency criterion before the run, and check whether spend stays within the chosen scenario budget.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!