Why Circuit breaker?

Circuit breaker Prevents cascading failures across microservices and Improves user experience by failing fast instead of hanging. Supports graceful degradation with fallbacks (e.g., cached responses, safe defaults).

How Circuit breaker Works?
It cycles through three states — Closed, Open, and Half‑Open — to balance resilience with recovery.

Closed State – Requests flow normally to the downstream service, tracks metrics like error rate, timeouts, and latency.
Open State – Triggered when failures exceed the configured threshold, breaker “trips” and immediately rejects further calls.This prevents wasted retries and protects system resources.
Half‑Open State – After a cooldown period, the breaker allows limited trial requests. If these succeed → breaker resets to Closed. If they fail → breaker returns to Open for another cooldown.

What is the Default condition of Circuit breaker to move to open state?
For Resilence4j Failure Rate Threshold: 50% with a sliding window size of 100 Request. I.E. If 50 calls of last 100 request fails then circuit breaker moves to open state. Wait Duration in Open State: 60 seconds. After 60 Seconds Circuit breaker comes to half open state with 10 trial calls to test recovery before deciding to close or reopen state.