[Backport 3.4] Add Hybrid Cardinality collector to prioritize Ordinals Collector#20208
Conversation
…9524) * Add Hybrid Cardinality collector to prioritize Ordinals Collector Current cardinality aggregator logic selects DirectCollector over OrdinalsCollector when relative memory overhead due to OrdinalsCollector (compared to DirectCollector) is higher. Because of this relative memory consumption logic, DirectCollector is selected for high cardinality aggregation queries. DirectCollector is slower compared to OrdinalsCollector. This default selection leads to higher search latency even when Opensearch process have available memory to use ordinals collector for faster query performance. There is no way to figure out memory requirement for nested aggregation because number of buckets are dynamically created as we traverse through all the matching document ids. To overcome this limitation, this change create a hybrid collector which will first use Ordinals Collector and will switch to DirectCollector if memory usage for Ordinals Collector Increase beyond certain threshold. When Hybrid collector switch from Ordinals Collector to Direct Collector, it will utilize already computed aggregation data from Ordinals Collector so that we do not have to rebuild aggregation result using Direct Collector. Signed-off-by: Anand Pravinbhai Patel <anapat@amazon.com> * Address PR comments Signed-off-by: Anand Pravinbhai Patel <anapat@amazon.com> * Address PR comments Signed-off-by: Anand Pravinbhai Patel <anapat@amazon.com> * Fix UTs Signed-off-by: Anand Pravinbhai Patel <anapat@amazon.com> --------- Signed-off-by: Anand Pravinbhai Patel <anapat@amazon.com> (cherry picked from commit 710d02f) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
|
❌ Gradle check result for 24a90f6: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
❕ Gradle check result for 24a90f6: UNSTABLE Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 3.4 #20208 +/- ##
============================================
+ Coverage 73.23% 73.27% +0.03%
+ Complexity 71787 71760 -27
============================================
Files 5793 5794 +1
Lines 328098 328218 +120
Branches 47250 47261 +11
============================================
+ Hits 240295 240486 +191
+ Misses 68556 68408 -148
- Partials 19247 19324 +77 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Backport 710d02f from #19524.