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

SOLR-16968: The MemoryCircuitBreaker now uses average heap usage #1905

Merged

Conversation

janhoy
Copy link
Contributor

@janhoy janhoy commented Sep 8, 2023

https://issues.apache.org/jira/browse/SOLR-16968

Introduced a new utility class AveragingMetricProvider that will cache the average for a double value provided by the breaker. Uses a scheduled executor every 5 seconds, which is shared by all instances of this class. This same utility can be used by other CBs to achieve the same, but I started with MemoryCircuitBreaker.

As this requires some cleanup of executor threads, CircuitBreaker now implements Closeable and the registry will close all CBs on close, which is also called from CoreContainer#doClose. I also added some synchonization on the map, which isn't really necessary in normal runtime, but I figured useful for tests.

NOTE that this may conflict with other in-flight CB PRs...

@janhoy janhoy requested a review from cpoerschke September 8, 2023 12:13
@janhoy janhoy requested a review from atris September 8, 2023 13:33
@janhoy
Copy link
Contributor Author

janhoy commented Sep 8, 2023

@atris feel free to weigh in here. The intention is to get fewer "false positive" request rejections due to short spikes. Now there will be some delay (0-30s) from heavy memory pressure starts until the breaker starts tripping, and likewise some time before we allow requests again after cooling down. So if the client implements some kind of exponential backoff logic on receipt of HTTP 429 errors, the system will stabilize right under the memory threshold. If they don't, it will be an oscillating pattern on and off, but hopefully give Solr time to recover in between.

Do you, perhaps from experience, see any argument for a shorter reaction time?

@janhoy janhoy force-pushed the SOLR-16968-Averaging-Memory-Circuit-Breaker branch from 9ed1662 to 8d67701 Compare September 8, 2023 16:22
@janhoy janhoy force-pushed the SOLR-16968-Averaging-Memory-Circuit-Breaker branch from 7728cf0 to 18968f1 Compare September 15, 2023 10:49
@janhoy
Copy link
Contributor Author

janhoy commented Sep 20, 2023

Planning to merge this on friday...

@janhoy janhoy merged commit 8ca4a5d into apache:main Sep 22, 2023
2 checks passed
@janhoy janhoy deleted the SOLR-16968-Averaging-Memory-Circuit-Breaker branch September 22, 2023 08:05
janhoy added a commit that referenced this pull request Sep 22, 2023
justinrsweeney pushed a commit to cowpaths/fullstory-solr that referenced this pull request Nov 2, 2023
justinrsweeney pushed a commit to cowpaths/fullstory-solr that referenced this pull request Apr 26, 2024
nginthfs pushed a commit to cowpaths/fullstory-solr that referenced this pull request May 22, 2024
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

Successfully merging this pull request may close these issues.

3 participants