Lesson 7 of 9 · 24m
Failure Is a Design Input, Not an Operations Surprise
Design for dependency failure, overload, data corruption, and operator mistakes with explicit blast radius, timeouts, retries, and recovery paths.
The architecture diagram always looks clean because it omits the demon: partial failure. In production, the database is up but slow, the queue accepts messages but consumers lag, DNS resolves to a bad endpoint, TLS certificates expire at midnight, and one retry loop quietly triples traffic. Designing for failure means deciding what the system does when reality misbehaves.
Classify dependencies by failure consequence
Not every dependency deserves the same treatment:
hard dependency request cannot succeed without it
soft dependency feature degrades but core request succeeds
background job latency hidden from users until backlog matters
control-plane only existing traffic survives configuration lossAuthentication, primary storage, payment providers, recommendation models, metrics pipelines, and feature flags have different failure semantics. Do not put a soft dependency synchronously in the critical path unless its failure is acceptable as product behavior.
Timeouts and retries are a coupled system
A timeout without retry policy is incomplete. A retry without a deadline is a traffic amplifier. Use budgets:
end-to-end request budget: 800ms
auth lookup timeout: 100ms
inventory call timeout: 150ms
payment call timeout: 300ms
max retries: 1 for idempotent calls, 0 for charge captureRetries need jitter and exponential backoff. Non-idempotent calls need idempotency keys or no automatic retry. Retrying a charge because the response was lost is how customers get charged twice.
Design the blast radius
Blast radius is the set of users, tenants, regions, and workflows affected by a failure. Reduce it with partitioning, tenant isolation, cell-based deployment, feature flags, and progressive rollout. Multi-region is not automatically smaller blast radius; a bad global control-plane change can fail everywhere at once.
Corruption is worse than downtime
A service can recover from being unavailable. Recovering from silently wrong data is slower and more political. Protect critical writes with validation, constraints, checksums, audit trails, immutable logs where appropriate, backups that are actually restored, and explicit reconciliation jobs.
Operators are part of the system
Design runbooks, safe admin tools, kill switches, and rollback mechanisms. The system should make dangerous actions hard and reversible actions easy:
rollback application deploy minutes
disable recommendation feature one flag
pause queue consumers one controlled action
invalidate abusive public object targeted admin operation
restore backup rehearsed and timedObservability belongs here too: logs with correlation IDs, metrics for dependency health, traces across service boundaries, and dashboards tied to user journeys rather than machine vanity metrics.
Field notes
- A health check that always returns 200 creates fake resilience; check critical dependency behavior carefully.
- Circuit breakers help when dependencies fail, but bad thresholds can amplify outages.
- Test restore procedures. Untested backups are files, not recovery capability.
- In interviews, volunteer one concrete failure mode per major component. That habit separates operators from diagram artists.
Was this lesson helpful?