Please enable JavaScript.
Coggle requires JavaScript to display documents.
Circuit Braker Pattern - Coggle Diagram
Circuit Braker Pattern
🔄 Core States
🟢 Closed
Normal Ops
Traffic flows freely; failure counter = 0
🔴 Open
Failure Mode
Traffic blocked; immediately returns fallback/error
🟡 Half-Open
Testing Mode
Trial traffic allowed; checks if service recovered
⚡ State Transitions & Triggers
🟢 ➔ 🔴 (Closed to Open)
Failure threshold reached
Failure threshold reached (e.g., 50% fails or X timeouts)
🔴 ➔ 🟡 (Open to Half-Open)
Sleep Window timer expires
Sleep window timer expires (e.g., waits 30 seconds)
🟡 ➔ 🔴 (Half-Open to Open)
Single Trail Request Fails (service still broken)
🟡 ➔ 🟢 (Half-Open to Closed)
Consecutive trial successes reached (service healthy)
🛠️ Key Configuration Metrics
📊 Failure Rate Threshold
% of failed requests to trip the breaker
⏱️ Slow Call Rate Threshold
Number of calls (or seconds) to evaluate (e.g., last 100 calls)
⏳ Sliding Window Size
% of requests taking longer than allowed (latency spikes)
🛌 Wait Duration in Open
Time to wait before entering Half-Open state
🎯 Implementation Benefits
🛡️ Cascading Failure Prevention
Prevents resource exhaustion (thread pools, memory)
🩹 Graceful Degradation
Serves cached or static fallback data to users
🩹 Self-Healing Architecture
Gives downstream services breathing room to recover