The API Gateway is the central ingress portal for all north-south internet traffic. When an internal microservice experiences latency degradation, lacking a resilient Circuit Breaker causes pending requests to backlog, exhausting server thread pools and initiating a domino-style cascading system failure.
1. Circuit Breaker State Machine
Much like electrical circuit breakers, the software pattern features three distinct operating states:
- Closed: Normal operating mode. Requests pass to the backend while failure rates are tracked.
- Open: When error thresholds trip (e.g. 50% failures over 10 seconds), the circuit immediately opens. Inbound calls fail fast without hitting the degraded backend, allowing it to recover.
- Half-Open: After a cooldown window, exploratory canary requests test backend health before re-closing the circuit.
Advertisement / Sponsored