Skip to content
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

Enrich cache default can usage a ton of memory #120021

Open
nik9000 opened this issue Jan 12, 2025 · 1 comment
Open

Enrich cache default can usage a ton of memory #120021

nik9000 opened this issue Jan 12, 2025 · 1 comment
Labels
>bug :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP Team:Data Management Meta label for data/management team v8.16.0 v8.17.0

Comments

@nik9000
Copy link
Member

nik9000 commented Jan 12, 2025

Elasticsearch Version

8.16+

Installed Plugins

No response

Java Version

bundled

OS Version

any

Problem Description

In 8.16 we changed the default for enrich.cache_size from 1000 to 1% which should allow us to more carefully cache. The trouble is that we don't account for a few things in the cache's weight:

  1. The cache key. I'm seeing those in the 600 bytes size.
  2. Empty results.
  3. Results use their serialized size but are then stored as Map<String, Object> which is usually much larger.
  4. It sure looks like there isn't any intrinsic cost to a cache entry. Like, for the entry itself.

When you combine the first two, queries pointing to no documents in the enrich index cost 0 bytes. So, no matter the limit you configure, you can fill up memory with them.

But, yeah, I think we should include the size of the cache key. And Include an estimate of the cost of the List we store in the cache - even if it's empty. And, finally, I think we should uplift the cost of the exploded map. Or we should cache the serialized copy. I'm not entirely sure if it's worth a cost for the cache entry itself. That bit I don't know.

Steps to Reproduce

See above.

Logs (if relevant)

@nik9000 has a heap dump of a node the OOMed full of cache entries of empty results lists.

@nik9000 nik9000 added :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >bug needs:triage Requires assignment of a team area label v8.16.0 v8.17.0 labels Jan 12, 2025
@elasticsearchmachine elasticsearchmachine added Team:Data Management Meta label for data/management team and removed needs:triage Requires assignment of a team area label labels Jan 12, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP Team:Data Management Meta label for data/management team v8.16.0 v8.17.0
Projects
None yet
Development

No branches or pull requests

2 participants