-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Performance degradation in OpenSearch 1.1.0 due to Lucene 8.9.0 #2820
Comments
@rtiruveedulaarkin Have you tested against OpenSearch 1.2 that uses Lucene 8.10.1? We had a similar issue recently (#1647) that was mitigated in Lucene 8.10.1. The Lucene issue you linked doesn't show any tests against 8.10.1, so I'm curious if LUCENE-9917 also mitigates the regression seen here. |
@andrross I have tested against OpenSearch 1.2.4 and 1.3.1. Both are using lucene 8.10.1. The performance issue is present in both these releases. |
@rtiruveedulaarkin And can you confirm that you're using the default |
@andrross I haven't specified codec while creating index. So the index must be using the default best_speed. |
Thanks @rtiruveedulaarkin We'll dig into this soon to reproduce it. The mitigation suggested in the Lucene ticket seems like a good optimization to implement in any case. |
@rtiruveedulaarkin can you set profile as true and post the following debug info for CardinalityAggregator -
|
@rishabhmaurya This is the debug info for CardinalityAggregator.
|
@rtiruveedulaarkin In your case |
I have tried with the following query. But OrdinalsCollector is still not used.
|
do you mind overriding the code to use OrdinalsCollector. This would give us a confirmation that its caused due to value lookup per document and not any other underlying issue. |
I made changes in the code to use OrdinalsCollector. But the performance is the same.
|
thanks for confirming, I will try to reproduce and dig deeper into it. |
can you try enabling eager_global_ordinals and compare performance, if its something acceptable for your use case. |
I did a quick experiment using this script and found that using execution hint as map could be atleast 10x slower for low cardinality cases, and >15x slowed for high cardinality cases (script for high cardinality)-
|
Using murmur plugin to precompute hashes and using hash fields for cardinality aggregation significantly helped one user. I'll ask them to post more update on this thread. |
We were able to achieve performance improvement with the use of murmur plugin to precompute hash value of a field in an index. Scenario: We are migrating from ElasticSearch v7.10 to OpenSearch v1.2. Post migration, we observed that a search query with Cardinality Aggregation was having performance degradation of 186%. Sample query is given below.
Steps Performed for Triage with Observations:
Performance Tuning changes:
Once the above changes were implemented, we were able to see good decrease in the execution time of the query. Though the response time didn't fall back to the pre Lucene 8.9.0 levels with murmur plugin, but this solution gives good response times in OpenSearch v1.2 Updated Debug section for the Index in the Profile API output:
|
Thanks @kcharikrish for working on it and posting the analysis. Conclusion so far is to use the right index configuration and adjust query params to avoid performance degradation. Closing this thread, feel free to open if above suggested configuration doesn't work for you. |
Is your feature request related to a problem? Please describe.
We are planning to upgrade from Elasticsearch 7.7.1 to OpenSearch 1.2.4 release. We have compared the performance of OpenSearch 1.2.4 with Elasticsearch 7.7.1. For cardinality queries (with keyword fields), the performance is degraded by 50%. So we couldn't upgrade to OpenSearch.
The performance degradation is observed from in OpenSearch 1.1.0 release onwards.
Below is the code snippet which is running slow in OpenSearch 1.1.0.
This degradation is caused due to lucene upgrade from 8.8.2 to 8.9.0. The commit is e153629
Lucene developer said this is caused due to an enhancement in Lucene and it has to be fixed in OpenSearch.
Lucene ticket that I have filed: https://issues.apache.org/jira/browse/LUCENE-10509
Describe the solution you'd like
As per Lucene developer (Adrien Grand):
The cardinality aggregation performs value lookups on each document. OpenSearch should change the way cardinality aggregations run to collect matching ordinals into a bitset first, and only look up values once the entire segment has been collected. This should address the performance problem and will likely make the cardinality aggregation faster than it was before Lucene 8.9.
Describe alternatives you've considered
None
Additional context
The text was updated successfully, but these errors were encountered: