-
Notifications
You must be signed in to change notification settings - Fork 24.2k
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
Named query performance degradation after upgrading to 8.13.2 (from 8.7.1) #108556
Comments
This was reported at: https://discuss.elastic.co/t/359189 |
Pinging @elastic/es-search (Team:Search) |
Looking at the reproduction (thanks for providing one) the issue seems to be around a single query with 4k named term queries. |
@jimczi Thank you for taking a look at this. I've already removed named queries from our production query and confirmed it improved response time to the same level as 8.7 with named queries. So I'm still suspecting the named query at the moment. I'll try to reproduce it with a query that matches documents. Edit: Regarding performance #108659 is more important for us as we haven't figured out a workaround. For this (possible) named query issue, removing named queries worked for us as a workaround. |
@jimczi I've updated the reproduction query to match documents as shimpeko/es_named_query_perf@b897f91 and I still see a notable performance difference between 8.7.1 and 8.13.2 8.7.1
8.13.2
|
I can reproduce the same regression without the named queries @shimpeko . The issue as explained above is related to the number of term queries on a single request. The change in apache/lucene#12183 introduces an overhead for large boolean queries composed of multiple term queries. It is emphasised when using named queries since they execute the query a second time during the fetch phase.
I suspect that #108659 is a duplicate of this problem. Are you running lots of term queries (similar to this example) in a single boolean query? |
Thank you so much for the investigation. I appreciate it.
I maybe misunderstood something but this example, the query on this issue, has multiple match queries in a single boolean query, not term queries. Regarding #108659, again they are match queries (not term queries) but yes, the programmatic (slow) production queries have 100+ multi_match queries in a boolean query. Just FYI, we can still observe a significant difference in
Thank you again for confirming the issue. I now think that my previous comment "I've already removed named queries from our production query and confirmed it improved response time to the same level as 8.7 with named queries." is not correct. What might have actually happened was that I removed named queries from our production environment, which improved the 99th percentile response time; however, a small number of queries with many match queries remained slow. I thought this was a separate problem and opened another GitHub issue as #108659.
This would really help us if it fixes this issue and #108659. We are considering downgrading to 8.7 but it is a task as ES doesn't support downgrade. |
@jimczi ^ |
Elasticsearch Version
8.13.2
Installed Plugins
No response
Java Version
bundled
OS Version
official docker image
Problem Description
After upgrading from 8.7.1 to 8.13.2, some of our queries are more than 5x times slower (longer response time). After digging, I've identified that the named query is causing the problem. Queries with "_name" get about 5x times slower, while the performance of queries without "_name" stays the same.
We are running ES on K8S using ECK but it can be reproducible with docker environments. The same query takes longer in 8.13.2.
8.7.1
8.13.2:
Steps to Reproduce
Please see https://github.com/shimpeko/es_named_query_perf/tree/main
Logs (if relevant)
No response
The text was updated successfully, but these errors were encountered: