-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How long dose it recover when it breaker #61
Comments
I'm not sure what the recovery time is but it looks like it's not configurable and not documented. |
This is where it is defined: circuitbreaker/circuitbreaker.go Line 391 in 4afb847
|
it seems that it's using exponential backoff by default: circuitbreaker/circuitbreaker.go Line 95 in 4afb847
|
The backoff time is defined by backing backing.ExponentialBackOff , it's assigned with default values and further customized at: circuitbreaker/circuitbreaker.go Lines 139 to 146 in 4afb847
The actual backoff time is controlled by ExponentialBackOff type. Entire logic is documented and explained in official documentation. Following is the snippet from the documentation that explains this logic
Request # RetryInterval (seconds) Randomized Interval (seconds) 1 0.5 [0.25, 0.75] 2 0.75 [0.375, 1.125] 3 1.125 [0.562, 1.687] 4 1.687 [0.8435, 2.53] 5 2.53 [1.265, 3.795] 6 3.795 [1.897, 5.692] 7 5.692 [2.846, 8.538] 8 8.538 [4.269, 12.807] 9 12.807 [6.403, 19.210] 10 19.210 backoff.Stop It's also worth noting that default value of InitialInterval is 500ms and that of MaxElapsedTime is 0 in circuitbreaker. Thus table above gives you each backoff duration window with the exception that it doesn't stop growing at Request # 10 since the value of MaxElapsedTime is 0 by default in circuitbreaker. It'll keep on backing off exponentially with same logic till it attains max value of 1 minute (default from backoff) thus leading to final randomized interval between 30 and 90 seconds with default values from breaker. You can customize these values if you wish to. Use NewBreakerWithOptions directly instead of convenient NewXXXX variant wrappers and pass your own instance of ExponentialBackOff with specific values as per your needs. |
it's code
How do I calculate the recovery time?
The text was updated successfully, but these errors were encountered: