-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Add single request circuit breaker. #46962
Add single request circuit breaker. #46962
Conversation
Pinging @elastic/es-core-infra |
@howardhuanghua thanks for this suggestion. I have a question: this change does not really add a per-request circuit breaker, does it? @howardhuanghua what kind of massively expensive request is this kind of allocation limit catching for you in practice? |
…o single_request_breaker
Hi @original-brownbear, sorry for the delay. Yes you are right, this PR is only considered a small piece of memory in search request. The problem we have encountered is mainly about coordinate node breaker, and I also opened #46751 and #47806. Sometimes a single big range aggregation query request consumes lots of memory on coordinate node and may impact other regular requests. So we try to add limit for single request. It’s hard to collect all the pieces of memory usage over a single search request. But I think we could collect major memory usage for single request. I have some ideas for single request on coordinate node:
Alternatively, if we have already pre-calculated each shard result size in elasticsearch/server/src/main/java/org/elasticsearch/action/search/ArraySearchPhaseResults.java Lines 42 to 45 in a8a7477
In this case, since all the received shard result responses have been deserialized, so this calculated size is the real memory usage rather than pre-check. |
After reviewing this PR, we do not believe this change is worth the added complexity. This change will not prevent many if any conceivable out of memory situations that would not be covered by other circuit breakers already with a setting value of 30%. Also, as pointed out above, there is not necessarily a correlation between message size and the amount of memory a request will actually consume which limits the use-cases for this approach. For now we decided to only pursue limiting the request size like that on the REST layer (see #67804) which will also filter out large transport messages from indexing on the transport layer. Since we do not plan to move forward with the approach in this PR, I hope you don't mind I close it. |
Currently we have request circuit breaker, but all the query requests would share this memory limit pool, then requests would be impacted with each other.
This PR introduced a single request circuit breaker which could limit memory usage of single request. A data analysis cluster may support many regular small search requests, however, if user triggers a query that consumes a lot of memory may cause other queries to fail. In this case, we could set this single request circuit breaker to prevent single search request that consumes a lot of memory and impact regular search requests.
By default, we set new setting
indices.breaker.single_request.limit
to30%
which is half ofindices.breaker.request.limit
.