What is a circuit breaker?

A circuit breaker is a resilience pattern that prevents an application from repeatedly calling a failing dependency. When failures exceed a threshold, the circuit can open and fail requests quickly instead of continuing to send traffic to the unhealthy dependency. After a recovery period, the circuit can enter a half-open state and test whether the dependency has recovered.

Key Takeaways
  • Circuit breakers improve resilience.
  • Open circuits fail quickly.
  • Half-open state can test recovery.
  • They help prevent cascading failures.
Knowledge Check

What is the main purpose of a circuit breaker?