Skip to content

When Things Fail: Timeouts, Retries, and Availability Math

6 min reading

Outcome: Treat lost responses as uncertain outcomes, reason about repeated actions and calculate availability under explicit failure assumptions.

Page details

System Design foundations · Chapter 6 · Sources

Published · Last edited: · ~6 min reading · ~17 min with practice

20px

Know first: Memory, Disk, and Network: Why Caches Exist

System Design foundations glossary

Hypothetical scenario. Northwind sends a payment request and receives no reply before its deadline. Priya asks whether the customer paid. The timer answers a narrower question: the caller did not receive a qualifying response in time. It cannot, by itself, report the provider's final state.

One boundary can fail without the other

A partial failure affects some participants or communication paths while other work continues. The provider may be healthy while a response packet is lost. A local process may crash after the provider accepted the action. The caller's observation and the remote effect are therefore separate events.

A timeout is a policy for how long the caller waits. It lets the application stop occupying local resources or show a useful status. It is not an instruction that travels backward in time to undo a remote effect. Even a cancellation message needs a contract describing what happens if the remote action has already committed.

Provider acceptsThe effect may commitResponse is lostCaller reaches deadlineReconcile identityOutcome remains a question
Provider accepts: The effect may commit → Response is lost: Caller reaches deadline → Reconcile identity: Outcome remains a question. Illustrative conceptual flow.

For an additive action such as creating a charge, retrying with a new identity can ask for another effect. An idempotency key names the same intended operation across attempts when the receiver supports that contract. Its scope, parameter binding, supported retry period and recovery behavior matter. A key that expires before the client stops retrying cannot support an unlimited promise.

Count the unknowns without inventing duplicates

Illustrative calculation. Choose one thousand payment intentions and twenty missing responses. The caller has twenty unresolved observations, not twenty proven duplicate charges. If ten of those first attempts committed and all ten are retried without protection, ten extra charges are a possible result under those added assumptions. If the receiver deduplicates the same action correctly, repeated attempts can instead resolve to the same logical result.

Reconciliation means obtaining evidence about the original action: a supported status lookup, a durable receipt or another authoritative record tied to that identity. It is different from assuming failure and starting over. An unavailable status endpoint leaves the application uncertain; the interface should communicate that state rather than announce an invented outcome.

In the wild. RFC 9110 distinguishes idempotent HTTP method semantics and discusses automatic retries after communication failure. The specification is useful because it ties repeatability to intended effects rather than to the number of times code executes. A business payment contract still needs its own effect boundary.

Give the availability percentage a denominator

Availability can be measured over time or over eligible requests. A time-based target counts acceptable service time divided by the measured interval. A request-based target counts good eligible requests divided by all eligible requests. The two can disagree when traffic varies; an outage at peak demand can harm more requests than an equally long quiet-period outage.

For a time-based toy budget, choose a thirty-day month. The interval contains 30 × 24 × 60 = 43,200 minutes. A 99.9% availability target leaves 100% − 99.9% = 0.1% unavailable time. As a fraction that is 0.001, so the allowance is 43,200 × 0.001 = 43.2 minutes. This is the arithmetic of the chosen interval, not a statement that every calendar month has thirty days.

Combinations need a failure model

Suppose a request needs both components A and B, each available with probability 0.999 for the same kind of observation. If their availability events are independent, the series probability is 0.999 × 0.999 = 0.998001, or 99.8001%. Requiring both makes success less likely than requiring either one alone.

Now suppose either of two independent components can fully serve the request. Both must be unavailable for the service to be unavailable. Each has unavailability 0.001, so joint unavailability is 0.001 × 0.001 = 0.000001. Availability is 1 − 0.000001 = 0.999999, or 99.9999%. That attractive number follows from strong assumptions: independence, sufficient surviving capacity and correct failover.

Two replicas sharing a power supply, deployment bug or credentials are not independent for those failures. A backup that cannot handle the traffic may be reachable yet fail the request-level contract. Replication changes a failure model; merely drawing a second box does not establish the product used in the calculation.

Failure awareness before failover

Misconception: a timeout proves the operation failed. Treat it as an unknown outcome until authoritative evidence resolves it. This applies to a lost database acknowledgment, a charge request and a support-ticket creation. The right next action depends on what can be safely repeated and what evidence can be recovered.

Use these calculations to compare explicit failure assumptions and expose common dependencies. They do not predict incident frequency from thin air, prove an SLO will be met or justify a retry storm. Repeated attempts consume capacity, so the reliability course adds bounded retries, jitter, load shedding and reconciliation rather than treating retries as free availability.

Check yourself

The client times out after a charge request. Should the UI immediately say payment failed?

No. The action may have committed. Preserve its identity and show an unresolved/pending state while reconciling through the provider’s supported evidence path.

Why is 43.8 minutes not the chosen monthly budget here?

This example explicitly uses thirty days: 43,200 minutes × 0.001 = 43.2 minutes. A different average-month denominator must be labeled separately.

Can two providers sharing one failed credential deliver the independent-parallel result?

No. That failure is correlated. The 99.9999% toy result requires independent unavailability plus usable surviving capacity and correct failover.

Go deeper