Break a downstream service and watch it fail fast, then recover.
When an external microservice slows to a crawl, uncapped timeouts exhaust your application's thread pool and bring down the whole system. A circuit breaker fails fast in <1ms, returns fallback data, and tests recovery via half-open probes.
LIVE · Resilience4j State Machine · 60% Threshold
Circuit State: CLOSEDDownstream: HEALTHY
Current Circuit StateCLOSED
Circuit is CLOSED. All requests pass through to downstream service normally.
Sliding Window (Last 5 Calls):
·
·
·
·
·
// Circuit Breaker Execution Log
Send requests or break downstream service to watch the state transitions.
On the live site, requests hit real Spring Boot endpoints managing thread-safe sliding windows and automatic probe timers.
Circuit Breaker State Machine
CLOSED (normal traffic) → trips to OPEN when failures exceed 60% → transitions to HALF-OPEN after 5s wait duration to probe recovery.
Client Request
API Traffic
GET /call
Circuit Breaker
CLOSED / OPEN / HALF_OPEN
If CLOSED / HALF-OPEN
Fallback Handler
Graceful cached response
If OPEN (Fast fail)
Downstream Service
External dependency
OPEN State: Fails fast in <1ms without blocking Tomcat threads | CLOSED: Normal 200 OK
Count-based windows (e.g. last 10 calls) react predictably under burst traffic, while time-based windows (e.g. last 30s) are ideal for services with low, steady call volumes.
Fallback Data vs Clean Fast-Fail Error
Returning cached, degraded data (e.g., product recommendations without personalized rankings) keeps users engaged, while critical payment operations must fail fast with clean 503s.
Thread Pool Isolation (Bulkhead) + Circuit Breakers
Pairing a circuit breaker with a dedicated bulkhead thread pool ensures that even in the brief window before a breaker trips, a slow downstream cannot consume all container threads.