Don't Circuit Break Recovery Requests #46059
Closed
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.
Problem
Recovery requests are likely to trip the cirucit breaker under heavy load
which might lead to unfortunate side-effects in nodes under pressure.
A node temporarily under high load will be less likely to fail recovery
leading to permanent changes in allocation.
Moreover, the requests sent by the recovery mechanism are all bound in
byte size by design. If they are sent in rapid succession then the memory
used by strong references to them will be bounded but the memory used
by unreferenced objects that resulted from them could heavily fluctuate.
This makes the real-memory circuit breaker's memory use estimation
that does not account for GC particularly inefficient when it comes to
recoveries (#40115).
Solution
Turn off the circuit breaker for recoveries. Users have other means of
limiting the memory use of recoveries by setting the recovery chunk
size and parallelism. Given the bounded amount of memory used by
recoveries a user can either lower the amount of resources allocated
to recoveries in the settings or adjust the real-memory circuit breaker
limits slightly to account for this change.
I think its a fair assumption that the number of clusters that would
see nodes running out of memory as a result of this change is small.
Also it would be a subset of those clusters that currently see recovery
failures as a result of the circuit breaker and those should be fixed
regardless.
Unfortunately, I don't think we can use the same solution for the
case of replication requests tripping the circuit breaker as those
are not naturally bounded in size.
Relates #44484
Example of the user impact: https://discuss.elastic.co/t/7-0-1-new-circuitbreaker-segment-bigger-than-heap-should-this-break/195455