NewWork mode: your Claude Code or Codex on work calls, answering from your project's codeSkip to content
Middle+0 views

Which patterns for ensuring microservice fault tolerance do you know?

Practice

AI answer

Common microservice resilience patterns:

  • Timeouts for network calls so requests do not hang indefinitely.
  • Retries with exponential backoff and jitter—only for transient errors and idempotent operations; it is important to limit the number of attempts.
  • Circuit breaker: temporarily stops calls to a failing dependency and later checks whether it has recovered.
  • Bulkhead: isolates thread pools, connection pools, or resource limits so a failure in one dependency does not exhaust the resources of the entire service.
  • Load limiting and backpressure: limits on requests, queues, and concurrency, with controlled rejection of excess load.
  • Fallback and graceful degradation: for example, returning cached or partial data when appropriate.
  • Replication, health checks, and automatic failover to healthy instances.
  • Queues and asynchronous processing to decouple services; handlers must account for retries and duplicates.

These patterns should be combined with metrics, logging, and tracing. Improper retries, such as retries without limits, can worsen overload.