Circuit Breaking for System Reliability
Circuit breaking is a resilience pattern that helps maintain system reliability by temporarily rejecting requests when error rates and request volumes exceed predefined thresholds. This prevents overloaded services from spiraling into failure and allows them time to recover.
When circuit breaking is enabled:
🚨 Requests are automatically rejected if too many errors occur within a given time window.
⏳ Traffic pauses for a set period to allow the upstream service to recover.
âś… The system automatically re-evaluates health and resumes traffic once conditions improve.
🔍 What are the Benefits of Circuit Breaking?​
Modern applications often rely on multiple microservices, APIs, or external dependencies. If one service becomes slow or fails, it can cause cascading failures across the entire system.
Key Benefits:
- Isolating failing services so they don't bring down the entire system.
- Reducing unnecessary load on struggling services.
- Ensuring graceful degradation instead of full service failure.
- If a downstream service becomes overloaded, circuit breaking can prevent other services from also failing.
- Prevents long wait times for users by cutting off slow or failing requests.
- Ensures high-priority services remain available even when others are experiencing high failure rates.
Circuit Breaking Examples​
The following examples show how to set up an endpoint that allows only 1 request every 60 seconds and trips the circuit breaker for 2 minutes.
Check out the circuit breaking traffic policy action page for more details about how it functions and the parameters it accepts.
- AgentEndpoint
- CloudEndpoint
- Ingress
- Gateway API
Loading…
Loading…
đź’ˇ Ingress
resources do not natively support circuit breaking, but they can be extended using a traffic policy.
1. Create an NgrokTrafficPolicy
​
Loading…
2. Use the NgrokTrafficPolicy
on an Ingress
​
Loading…
đź’ˇ Gateway API resources do not natively support circuit breaking, but they can be extended using a traffic policy.
1. Create an NgrokTrafficPolicy
​
Loading…
2. Use the NgrokTrafficPolicy
on a Gateway
​
The following example showcases supplying the NgrokTrafficPolicy
on a Gateway
resource. All requests to the Gateway
will run the traffic policy.
If you prefer, NgrokTrafficPolicy
can also be used on the route level by using an externalRef
filter on an HTTPRoute
. See the using Gateway API guide for examples.
Loading…