Kubernetes and Cloud Native Associate (KCNA)Cloud Native ArchitectureMedium

A team is developing a highly available, fault-tolerant microservices application. They want to prevent a single failing downstream service from overwhelming an upstream service with continuous requests, which could lead to resource exhaustion and cascading failures. Which resilience pattern should they implement to automatically stop calls to a failing service after a certain threshold?

  1. ARetry Pattern
  2. BBulkhead Pattern
  3. CSaga Pattern
  4. DCircuit Breaker
Show answer & explanation

Correct answer: D. Circuit Breaker

The Circuit Breaker pattern is designed to prevent an application from repeatedly trying to invoke a service that is likely to fail. After a configurable number of failures, it 'trips' the circuit, preventing further calls for a period, thus protecting the upstream service from being overwhelmed and allowing the downstream service to recover.

Why the other options are wrong

  • A. Retry Pattern re-attempts failed operations, which can exacerbate problems with a truly failing service.
  • B. Bulkhead Pattern isolates resources to prevent cascading failures but doesn't specifically stop repeated calls to a failing service.
  • C. Saga Pattern is for managing distributed transactions and is unrelated to preventing cascading failures from repeated calls to a failing service.

Circuit Breaker Pattern

A design pattern used in distributed systems to prevent cascading failures. It wraps calls to potentially failing services, monitoring for failures and 'tripping' the circuit to prevent further calls when a threshold is met.

  • Prevents repeated calls to failing services.
  • Protects upstream services from being overwhelmed.
  • Allows downstream services time to recover.
  • Has states: Closed, Open, Half-Open.

Memory trick: Circuit Breaker cuts connections when current crashes.

More Cloud Native Architecture questions