Skip to content

[BUG] reduced performance on GlobalOrdinalsStringTermsAggregator #17979

Closed
@bruce-hong-glean

Description

@bruce-hong-glean

Describe the bug

After refactoring aggregation precomputations to a unified API, there are now (almost) consecutive calls to tryPrecomputeAggregationForLeaf and getLeafCollector.

When running aggregations with GlobalOrdinalsStringTermsAggregator, this calls valuesSource.globalOrdinalsValues(ctx); twice, which we've seen to be expensive on several clusters.

My question is: can this value be reused across aggregation computations? As far as I can tell, it's not modified between the two calls, but if it's dangerous to do so would it make sense to at least move

SortedSetDocValues globalOrds = valuesSource.globalOrdinalsValues(ctx);

inside the block:

if (collectionStrategy instanceof DenseGlobalOrds
            && this.resultStrategy instanceof StandardTermsResults
            && subAggregators.length == 0)

to minimize recomputations?

Related component

Search:Aggregations

To Reproduce

Execute a an aggregations query that uses GlobalOrdinalsStringTermsAggregator with expensive globalOrdinalsValues computation.

Expected behavior

Ideally only compute globalOrdinalsValues when it's used and at most once.

Additional Details

Screenshots
Image

Host/Environment (please complete the following information):

  • OS: Linux
  • Version: 2.19.1

Metadata

Metadata

Type

No type

Projects

Status

✅ Done

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions