Skip to content

Improve Memory Accounting and Stability in FetchPhase and Multi-Search #139132

@jimczi

Description

@jimczi

The current memory handling in the fetch phase and during multi-search accumulation does not fully utilize the reference-counted lifecycle of SearchHit.
As a result, memory used by hits is not consistently tracked by the request circuit breaker, and large fetch results or large multi-search responses can accumulate without proper accounting.

Additionally, the fetch phase still returns results as a single large payload rather than chunking, which increases peak memory usage and limits Elasticsearch’s ability to protect itself from large responses.

This issue tracks the core changes needed to improve stability and ensure predictable, safe memory behavior in fetch and multi-search operations:

  • Adapt the memory accounting in the FetchPhase to follow the lifecycle of the ref-counted SearchHit.
    (This ensures memory is correctly accounted on the coordinating node and during multi-search accumulation)

  • Revise the request circuit breaker limit for small heaps to provide safer headroom for large fetch responses.

  • Chunk FetchPhase results instead of producing a single large blob, reducing peak memory usage and enabling safer coordination behavior. ([WIP] Implement chunked fetch streaming with circuit breaker integration #139124)

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search Foundations/SearchCatch all for Search Foundations>enhancementSupportabilityImprove our (devs, SREs, support eng, users) ability to troubleshoot/self-service product better.Team:Search FoundationsMeta label for the Search Foundations team in Elasticsearch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions