Skip to content

Commit ea3dbc7

Browse files
anandpatel9998fdesu
authored andcommitted
Add Hybrid Cardinality collector to prioritize Ordinals Collector (opensearch-project#19524)
* 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>
1 parent c0b0e34 commit ea3dbc7

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3838
- Add search API tracker ([#18601](https://github.com/opensearch-project/OpenSearch/pull/18601))
3939
- Support dynamic consumer configuration update in pull-based ingestion ([#19963](https://github.com/opensearch-project/OpenSearch/pull/19963))
4040
- Cache the `StoredFieldsReader` for scroll query optimization ([#20112](https://github.com/opensearch-project/OpenSearch/pull/20112))
41+
- Add Hybrid Cardinality collector to prioritize Ordinals Collector ([#19524](https://github.com/opensearch-project/OpenSearch/pull/19524))
4142

4243
### Changed
4344
- Handle custom metadata files in subdirectory-store ([#20157](https://github.com/opensearch-project/OpenSearch/pull/20157))

0 commit comments

Comments
 (0)