Reliability patterns
Limit the time a request can occupy resources
A timeout limits how long an operation may wait; an end-to-end deadline is the time available to the entire request path. Use remaining time to bound each dependency call. For a 900 ms catalog deadline, reserve 100 ms for response handling and allow at most two inventory attempts of 300 ms with a bounded 100 ms gap. The total is 800 ms in this simplified worst-case plan. Real execution has scheduling and network overhead, so check the remaining deadline before every attempt and propagate cancellation where supported. A caller timing out does not prove that the server stopped working.
Deadline: 900 ms2 attempts × 300 ms + 100 ms backoff + 100 ms reserve = 800 msRemaining headroom: 100 msPrevent retries from multiplying failures
A retry is an additional attempt after a failed or uncertain attempt. Retry only classified transient failures within the deadline and a shared attempt budget. Backoff delays repeated requests, and jitter spreads synchronized clients over time. Do not retry every error: invalid input or a permanent authorization rejection needs a different correction. If three layers each make up to three total attempts, a single original request can reach the last dependency 27 times. Prefer one deliberate retry owner or a shared budget; cap concurrent requests and queues to avoid turning a slowdown into overload.
Three nested layers: 3 × 3 × 3 = 27 attemptsOne retry owner: at most 3 downstream attemptsMake repeated requests safe
Idempotency means that repeating a particular operation has the same intended effect as performing it once. A catalog read is usually safe to repeat, but creating an order is not automatically safe: the first attempt could commit before its reply is lost. For writes, use an application-level idempotency key scoped to the caller and operation, and persist the outcome atomically with the effect. Reject reuse with a different payload. Retain the record for a defined retry horizon. Kubernetes does not give a workload exactly-once business behavior simply because it restarts failed containers.
order key K, payload A -> order 41 createdorder key K, payload A -> existing order 41order key K, payload B -> reject conflicting reuseContain a slow dependency
A circuit breaker temporarily rejects dependency calls when failure criteria are met, then permits a limited recovery trial after a cooldown. It differs from a retry policy. Bound the number of in-flight requests and isolate pools for independent workloads. If inventory is unavailable, the catalog could return clearly marked stale availability for browsing but must not claim an order was confirmed. Choose fail-closed behavior for operations requiring fresh authoritative data. Recovery requires checking the dependency and user-visible service, not just waiting for a timer.
Closed: calls allowedOpen: fail fast; use only approved fallbackHalf-open: bounded recovery trialTrial succeeds -> consider closing; failure -> reopenUse Kubernetes controls for their actual purpose
Readiness determines whether a Pod is considered ready for ordinary Service traffic; removal is not instantaneous and existing connections may persist. Liveness can restart a stuck container but cannot repair a slow shared dependency. Graceful termination should stop accepting new work and drain in-flight work within its configured grace period. Spread replicas across failure domains where capacity permits. A PodDisruptionBudget limits eligible voluntary evictions; it does not prevent node failure, enforce application availability, or constrain a Deployment rollout in the same way. Run the offline retry and circuit scenarios before considering a separately approved lab.
Readiness -> traffic eligibilityLiveness -> container recoveryPDB -> eligible voluntary eviction constraintSLO -> observed user outcomeFurther reading and practice
Offline practice: lab-fixtures/sre-reliability/README.md. All data are synthetic. PromQL and kubectl snippets are static and not executed. Official sources are listed in the chapter review.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Reliability patterns — knowledge check
Choose bounded retries, timeouts, idempotency and Kubernetes reliability controls.
What does an end-to-end deadline bound?
Three nested layers each make three attempts. Worst-case downstream attempts?
A create-order response is lost after the write commits. What makes a retry safe?
What is the purpose of an open circuit breaker?
What can a PDB protect against?