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

Support for Half-Open state in Circuit Braker pattern #1459

Closed
renatodelgaudio opened this issue Jan 19, 2017 · 7 comments
Closed

Support for Half-Open state in Circuit Braker pattern #1459

renatodelgaudio opened this issue Jan 19, 2017 · 7 comments

Comments

@renatodelgaudio
Copy link

Hi,
It's my understanding that the current version of the Circuit Braker pattern implemented in the Netflix library supports only two states:

  • Open
  • Closed

It would be great to add a middle state (Half Open) as described in the following link .

Quoting the description of the Half Open State:

Half-Open: A limited number of requests from the application are allowed to pass through and invoke the operation. If these requests are successful, it is assumed that the fault that was previously causing the failure has been fixed and the circuit breaker switches to the Closed state (the failure counter is reset). If any request fails, the circuit breaker assumes that the fault is still present so it reverts back to the Open state and restarts the timeout timer to give the system a further period of time to recover from the failure.

The Half-Open state is useful to prevent a recovering service from suddenly being inundated with requests. As a service recovers, it may be able to support a limited volume of requests until the recovery is complete, but while recovery is in progress a flood of work may cause the service to time out or fail again.

@56quarters
Copy link

I'm not a Hystrix dev but, the half-open state you describe is actually pretty much what Hystrix already does: https://github.com/Netflix/Hystrix/wiki/How-it-Works#circuit-breaker

@mattrjacobs
Copy link
Contributor

@56quarters is correct - this is already the way it works.

@renatodelgaudio
Copy link
Author

How do you specify how many requests should be forwarded to the service during the Half Open state?

@mattrjacobs
Copy link
Contributor

It's hardcoded to do a single request after the sleep window elapses. If It succeeds, it transitions to CLOSED. If it fails, it transitions to OPEN and goes back to sleep for the specified amount of time.

@mattrjacobs
Copy link
Contributor

Closing due to inactivity. Please re-open if there's more to discuss.

@Zhostr
Copy link

Zhostr commented Nov 6, 2019

It's hardcoded to do a single request after the sleep window elapses. If It succeeds, it transitions to CLOSED. If it fails, it transitions to OPEN and goes back to sleep for the specified amount of time.

More than two years have passed. Does Hystrix still hardcoded a single request? In my practice, the 1.5.18 version still do this. Looking forward to your reply. Thank you.

@Anubhav007
Copy link

Anubhav007 commented Apr 15, 2020

@mattrjacobs How can we hardcode the no of requests we want after the sleep window elapses? Also this means the run method of the command would get executed those many times right?

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

No branches or pull requests

5 participants