-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Streaming aggregation planning to determine the appropriate flush mode #19488
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
Streaming aggregation planning to determine the appropriate flush mode #19488
Conversation
|
@bowenlan-amzn @harshavamsi @mch2 please take a look. I'm still working on testing it and fixing checks |
|
❌ Gradle check result for c618a71: 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? |
c618a71 to
6e5888c
Compare
|
❌ Gradle check result for 6e5888c: 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? |
server/src/main/java/org/opensearch/search/streaming/FlushModeResolver.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/streaming/StreamingCostMetrics.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/streaming/FlushModeResolver.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/streaming/FlushModeResolver.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/aggregations/AggregatorTreeEvaluator.java
Show resolved
Hide resolved
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
aa03fc7 to
4c608dd
Compare
...-rpc/src/internalClusterTest/java/org/opensearch/streaming/aggregation/SubAggregationIT.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/streaming/StreamingCostMetrics.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/streaming/FlushModeResolver.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/streaming/FlushModeResolver.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/DefaultSearchContext.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/aggregations/AggregatorTreeEvaluator.java
Show resolved
Hide resolved
Signed-off-by: Rishabh Maurya <[email protected]>
833b301 to
79fa652
Compare
|
❕ Gradle check result for 79fa652: 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. |
Signed-off-by: Rishabh Maurya <[email protected]>
#19488) * Planning for flush mode for streaming aggs Signed-off-by: Rishabh Maurya <[email protected]> * Address PR comments Signed-off-by: Rishabh Maurya <[email protected]> * Fix for nested aggs and more unit tests Signed-off-by: Rishabh Maurya <[email protected]> * Integ test to validate stream agg used using profile output Signed-off-by: Rishabh Maurya <[email protected]> * Make StreamNumericTermsAggregator streamable Signed-off-by: Rishabh Maurya <[email protected]> * Integ test for StreamNumericTermsAggregator Signed-off-by: Rishabh Maurya <[email protected]> * Improve coverage and PR comments Signed-off-by: Rishabh Maurya <[email protected]> * Minor refactor and address PR comments Signed-off-by: Rishabh Maurya <[email protected]> --------- Signed-off-by: Rishabh Maurya <[email protected]> (cherry picked from commit c851fdf) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
#19488) (#19512) * Planning for flush mode for streaming aggs * Address PR comments * Fix for nested aggs and more unit tests * Integ test to validate stream agg used using profile output * Make StreamNumericTermsAggregator streamable * Integ test for StreamNumericTermsAggregator * Improve coverage and PR comments * Minor refactor and address PR comments --------- (cherry picked from commit c851fdf) Signed-off-by: Rishabh Maurya <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-project#19488) * Planning for flush mode for streaming aggs Signed-off-by: Rishabh Maurya <[email protected]> * Address PR comments Signed-off-by: Rishabh Maurya <[email protected]> * Fix for nested aggs and more unit tests Signed-off-by: Rishabh Maurya <[email protected]> * Integ test to validate stream agg used using profile output Signed-off-by: Rishabh Maurya <[email protected]> * Make StreamNumericTermsAggregator streamable Signed-off-by: Rishabh Maurya <[email protected]> * Integ test for StreamNumericTermsAggregator Signed-off-by: Rishabh Maurya <[email protected]> * Improve coverage and PR comments Signed-off-by: Rishabh Maurya <[email protected]> * Minor refactor and address PR comments Signed-off-by: Rishabh Maurya <[email protected]> --------- Signed-off-by: Rishabh Maurya <[email protected]>
Description
Add streaming aggregation planning layer. Introduces smart fallback logic for streaming aggregations to prevent coordinator overhead and performance regressions as after #19373, cluster settings based flag will controls streaming for term aggs, so its enabled for all or none for term aggs and no way to control per request.
The high level idea is to determine the cost of running a complete agg tree using streaming mode, if the estimated overhead is too high on coordinator or it may perform poorly compared to traditional approach of flushing per shard, then fallback and recreate agg tree without using Streamable aggregators.
Changes
Streamableinterface for aggregators (in future other collectors) that support streaming with cost metrics reportingFlushModeResolver- Analyzes aggregation cost metrics and decides when to use streaming vs traditional processingStreamingCostMetrics- Captures bucket count, cardinality, and document estimates for cost analysisAggregatorTreeEvaluator- Evaluates entire aggregation tree streaming feasibility and falls back to traditional aggregators when needed.Enhanced existing
StreamStringTermAggregatorto implement Streamable interface with cost metricsAdded configurable thresholds for streaming decisions (max buckets, min cardinality ratio, min bucket count)
Automatically falls back to per-shard processing when streaming would cause coordinator overload or performance regression for low cardinality cases.
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.