Skip to content
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

Why don't use a rolling window to maintain the counts? #21

Open
spacewander opened this issue Apr 20, 2019 · 4 comments
Open

Why don't use a rolling window to maintain the counts? #21

spacewander opened this issue Apr 20, 2019 · 4 comments

Comments

@spacewander
Copy link

I just give a quite look to this library. This circuit breaker is mighty simple (compared with a Hystrix-like implementation) but still powerful.

However, I have a question about the counter expiration. Hystrix uses a rolling window to store the counts. This library doesn't maintain a rolling window, instead it drops the whole counts when the time interval is passed.

There may be a problem. Considered we use 10s as an interval, and we have 10000 requests come between 1s ~ 11s, 1000 requests per each second. The last 900 requests fail in the 11s. If the rolling window is used, the error rate will be 9% (900 / 10000). However, if we are unfortunate enough that the counts are expired in 10s, the error will be 90%, since we will recount the requests from the 11s.

Maybe I am missing something. Please let me know if I am wrong.

@YoshiyukiMineo
Copy link
Member

I think your proposal makes sense. I'm considering the rolling window feature.

@vtolstov
Copy link

@YoshiyukiMineo do you have some plans when you can implement it?

@kevinng250
Copy link

@YoshiyukiMineo If there are no plans to implement, may I open a PR with a solution for a sliding window?

@YoshiyukiMineo
Copy link
Member

I do not have enough time to implement it now. I welcome pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants