-
Notifications
You must be signed in to change notification settings - Fork 674
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
SOLR-16968: The MemoryCircuitBreaker now uses average heap usage #1905
Conversation
solr/core/src/java/org/apache/solr/util/circuitbreaker/MemoryCircuitBreaker.java
Outdated
Show resolved
Hide resolved
solr/core/src/test/org/apache/solr/util/BaseTestCircuitBreaker.java
Outdated
Show resolved
Hide resolved
solr/core/src/java/org/apache/solr/util/circuitbreaker/MemoryCircuitBreaker.java
Outdated
Show resolved
Hide resolved
solr/core/src/java/org/apache/solr/util/circuitbreaker/MemoryCircuitBreaker.java
Outdated
Show resolved
Hide resolved
solr/core/src/java/org/apache/solr/util/circuitbreaker/CircuitBreakerRegistry.java
Outdated
Show resolved
Hide resolved
solr/core/src/java/org/apache/solr/util/circuitbreaker/CircuitBreakerRegistry.java
Outdated
Show resolved
Hide resolved
solr/core/src/java/org/apache/solr/util/circuitbreaker/CircuitBreakerManager.java
Outdated
Show resolved
Hide resolved
solr/core/src/java/org/apache/solr/util/circuitbreaker/AveragingMetricProvider.java
Show resolved
Hide resolved
solr/core/src/java/org/apache/solr/util/circuitbreaker/AveragingMetricProvider.java
Outdated
Show resolved
Hide resolved
@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? |
9ed1662
to
8d67701
Compare
solr/core/src/java/org/apache/solr/util/circuitbreaker/AveragingMetricProvider.java
Show resolved
Hide resolved
7728cf0
to
18968f1
Compare
Planning to merge this on friday... |
(cherry picked from commit 8ca4a5d)
https://issues.apache.org/jira/browse/SOLR-16968
Introduced a new utility class
AveragingMetricProvider
that will cache the average for adouble
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 withMemoryCircuitBreaker
.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 fromCoreContainer#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...