"Good systems don't fail." Everything fails, all the time: disks, networks, whole data centers, and the services you call. Good systems aren't the ones that never fail; they're the ones that expect failure and keep working. Designing for failure means asking, for every component: what happens when this breaks?
1. No single point of failure
If one component's failure takes the app down, it's a single point of failure. On AWS:
- Run at least two copies of each tier in different Availability Zones (Regions and AZs).
- Put them behind a load balancer with health checks, so traffic stops going to an unhealthy copy (target groups and health checks).
- Use Multi-AZ databases (RDS Multi-AZ).
2. Timeouts
Never wait forever on another service. A call with no timeout, or a very long one, holds a thread or connection while it waits; enough stuck calls and your whole app stops responding, even though only one dependency is slow. Set connection and read timeouts on every network call, sized to what that call normally needs.
3. Retries with backoff and jitter
Many failures are brief: a dropped connection, a throttled request. Retrying fixes them, if you retry well:
- Exponential backoff: wait a little, then longer after each failure.
- Jitter: randomize the wait, so a thousand clients don't all retry at the same instant.
AWS SDKs retry for you with exponential backoff and jitter; in the standard retry mode the default is three attempts in total (one request plus two retries). For your own service-to-service calls, use a library that does the same.
4. Cap retries and make them safe
Retries have a dark side. If every layer retries three times, one failing call at the bottom can become dozens of requests, turning a small outage into a flood. So:
- Cap the number of attempts and the total time spent.
- Retry only errors that are retryable (throttling, timeouts, 5xx), not validation or permission errors.
- Make operations idempotent, safe to run twice, for example with an idempotency key on "create payment", so a retry after a timeout doesn't charge a customer twice.
5. Fallbacks
When a dependency is down, a degraded answer beats an error screen: a cached result, a simpler page, default recommendations, or a queue that processes the request later (SQS).
Where AI fits
Model calls fail like any other dependency, and in two ways that matter: throttling (quota or capacity limits) and slow responses (long answers take time). Amazon Bedrock's own guidance:
- Set read timeouts that fit long inference; a timeout shorter than a valid response causes pointless retries and duplicate work.
- Retry throttling and capacity errors with backoff and jitter, within a bounded retry budget, and honor a
Retry-Afterheader when one is returned. - If errors persist, fall back: use cross-Region inference profiles so Bedrock can route to other Regions, switch to another or smaller model, or show a friendly "try again shortly" message.
Quick recap
- No single point of failure: two or more copies across AZs, with health checks.
- Timeouts and capped retries with backoff and jitter; idempotent operations.
- Always have a fallback, including for model calls.