vulcand / oxy

Go middlewares for HTTP servers & proxies
Apache License 2.0
2.04k stars 323 forks source link

Feature request: cbreaker supports configuring a minimum number of requests #241

Open hanxiantao opened 4 months ago

hanxiantao commented 4 months ago

While using Traefik, we noticed that the circuitbreaker functionality within middlewares appears to be implemented using cbreaker. However, currently, cbreaker does not support configuring a minimum number of requests to determine when to trip the circuit, a feature that is available in frameworks like Hystrix. In Hystrix, there is a configuration parameter called requestVolumeThreshold (defaulted to 20), which dictates that only when this threshold is met or exceeded within a sliding time window, will Hystrix start calculating the failure rate and decide whether to open the circuit breaker based on this rate. Even if all requests fail within the sliding window, the circuit breaker will not open if the number of requests falls below this threshold. We would like to inquire if there are any plans to add similar functionality to cbreaker, allowing us to configure a minimum number of requests before circuit breaker decisions are made. This would prevent unnecessary circuit trips due to low request volumes and help maintain service stability under varying load conditions.

hanxiantao commented 4 months ago

If you find this proposal reasonable, I would be willing to assist in implementing this feature.