Throttle bulkhead from the circuit breaker on state transition #247
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
This PR attempts to address #244. It throttles the number of bulkhead tickets to 1 when the circuit opens, throttles to
success_threshold
when the circuit moves tohalf_open
, and removes the throttle when the circuit finally closes.Why
When the circuit is in an open state, we still allow all the workers that can acquire tickets to attempt the transition to
half_open
. When the circuit is half open, we allow all those workers to attempt the transition toclosed
, which can sap much needed capacity during a sustained outage.Note: This PR is still a work in progress, and there are several corner cases that need to be addressed. I'm looking for a high-level review of the approach.
Issues
SEM_UNDO
works when one process applies the throttle, and another removes it. Or what happens when the process that applied the throttle terminates. Needs to be thought through more.cc: @Shopify/servcomm