Threshold Configuration
You'll learn how to set the numeric thresholds that determine when a circuit breaker trips open to protect your system.
The Dials That Control Your Circuit Breaker
In the previous lessons, you learned that circuit breakers detect failures and count them. But how many failures should trigger an open circuit? Threshold configuration is where you set those critical boundaries.
Think of it like a smoke detector: you configure its sensitivity. Too sensitive, and cooking dinner triggers a false alarm. Not sensitive enough, and it won't warn you in time. Circuit breakers need similar tuning.
The Three Key Thresholds
Failure Threshold (Count)
The absolute number of failures before opening. Example: "Open after 5 consecutive failures."
Minimum Request Volume
The minimum number of requests that must occur before the circuit breaker even considers tripping. This prevents opening the circuit based on insufficient data.
Example: "Don't evaluate failure rate until at least 20 requests have been made in the time window."
Error Percentage Rate
The proportion of failures to total requests that triggers opening.
Example: "Open if 50% or more of requests fail (and we've seen at least 20 requests)."
Why All Three Matter
Using minimum request volume prevents premature circuit opening during low-traffic periods. If you only get 2 requests and both fail (100% error rate), that's not necessarily a systemic problem worth opening the circuit for.
Combining error percentage with absolute thresholds gives you flexibility: you can trip on "5 failures OR 50% error rate," whichever indicates a real problem.
Key Takeaway: Threshold configuration requires tuning three dials—failure count, minimum volume, and error percentage—to balance between protecting your system and avoiding false positives that unnecessarily degrade service.