Skip to content

Aggregations enhancement - better memory usage estimates to avoid circuit breaking #28220

Closed
@markharwood

Description

@markharwood

In a recent discuss forum post a user reported circuit breaking exceptions when using a large number of avg aggregations nested under two layers of terms aggregations.
Internally, the estimated memory cost of handling the request was (badly) estimated to be nearly 3GB in size but the actual size should have been much smaller. In part, this is due to a one-size-fits-all cost which is added for every aggregation which is hard-coded to 5kb in the aggregator base class.

For some aggregations this is often an underestimate (e.g. cardinality agg) while for simple metric aggregations like the avg aggregation it is a large over-estimate (which led to the circuit breaker error in the case mentioned above).

The solution requires

  1. A change to AggregatorBase to allow subclasses to override a new "getWeight" method.
  2. Changes to metric aggregations like avg to provide a better estimate of their memory cost.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions