Backend & systems·topic 7 of 13
Resilience and failure handling
Dependencies fail; the question is only what your service does about it. These are the named patterns for degrading on purpose instead of collapsing by accident.
Read in order · tick what you already know
- 01
you give up on the call after two seconds instead of holding the thread open until the other side eventually answers or does not.
Timeout
- 02
you reject the request immediately when you already know the dependency is down, instead of making the caller wait for a timeout.
Fail fast
- 03
you pass the remaining time budget down with the request so a service four hops deep knows there is no point starting.
Deadline propagation
- 04
the dependency got slow, everything retried, and the extra load is now the reason it cannot recover.
Retry storm
- 05
you add a random amount to every retry delay so ten thousand clients do not all come back at exactly the same second.
Jitter
- 06
you cap retries at a small fraction of total traffic so a struggling dependency does not get three times the load it was already failing under.
Retry budget
- 07
the call timed out and you genuinely do not know whether the other side did the work or not.
Partial failure
- 08
one service got slow, its callers filled up with waiting requests, and the failure walked all the way up to the front door.
Cascading failure
- 09
you ask how much of the product breaks if this one component dies, and design so the answer is not "all of it".
Blast radius
- 10
you trace the dependency graph and find one component whose failure takes everything else down with it.
Single point of failure
- 11
you give each downstream its own pool of connections so one slow dependency cannot consume every thread you have.
Bulkhead
- 12
the consumer tells the producer to slow down rather than silently buffering work it cannot keep up with.
Backpressure
- 13
you start rejecting requests immediately with a 503 instead of accepting work you have no chance of finishing in time.
Load shedding
- 14
the permissions service timed out and you had to decide, in advance, whether to let the request through or block it.
Fail open
- 15
the orchestrator asks whether the process is wedged and restarts the container when it stops answering.
Liveness probe
- 16
the instance says "not yet" while the cache warms, so the load balancer keeps traffic off it until it is genuinely able to serve.
Readiness probe
- 17
on SIGTERM you stop accepting new requests, finish the ones in flight, and only then exit.
Graceful shutdown
- 18
you deliberately kill an instance in production during working hours to find out whether the failover actually works.
Chaos engineering