Java Resilience patterns

Everything remote fails eventually. These are the patterns that keep one failure from becoming all of them, and the ways each is misused.

3 concepts · 9 interview questions

What this topic covers

Every concept in resilience patterns, and the questions each one gets asked as. Where a question links, it has a full write-up.

Retries and backoff

Retrying recovers from a transient failure and amplifies a real one. Backoff, jitter and a cap on attempts are what separate the two.

  • What can go wrong with a naive retry?
  • Why does backoff need jitter?
  • Which failures should never be retried?

Circuit breakers and bulkheads

A breaker stops calling a dependency that is clearly failing, so the caller fails fast. A bulkhead limits how much of your capacity any one dependency can consume.

  • What does a circuit breaker actually do?
  • How do you pick the thresholds?
  • What is a bulkhead, and what does it protect?

Fallbacks and graceful degradation

When a dependency is unavailable, something must still be returned or refused. Deciding what, per feature, is a product decision as much as an engineering one.

  • What is a good fallback, and what is a dangerous one?
  • How do you degrade a page when one section's service is down?
  • What is a cascading failure, and how do you stop one?

More in Microservices and APIs

See the whole reference map →