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

Unused repository plugins consume a lot of metaspace #97482

Open
original-brownbear opened this issue Jul 9, 2023 · 2 comments
Open

Unused repository plugins consume a lot of metaspace #97482

original-brownbear opened this issue Jul 9, 2023 · 2 comments
Labels
>bug :Core/Infra/Plugins Plugin API and infrastructure Team:Core/Infra Meta label for core/infra team

Comments

@original-brownbear
Copy link
Member

original-brownbear commented Jul 9, 2023

From looking into ES's metaspace usage the other day ...

Currently, just firing up a default Elasticsearch node that has no repositories configured, one can see that both the Azure and the S3 repositories use up a lot of metaspace even when unsued.
It's ~4.6M for the S3 plugin and ~6.3M for the Azure plugin. This might be a relevant amount of memory for small deployments, e.g. for a 512M heap deployment, an extra wasted 10M of off-heap memory isn't great.

In both cases the main contributor to these numbers is the Jackson dependency, for the Azure dependency redundant loading the Netty which we have on the classpath from the transport already (but in a separate loader) also adds 2M or so.

I wonder if we could introduce some sort of lazy loading here that would allow us to save those 11MB+ of off-heap memory here. Alternatively, maybe we could share the Netty (same version for Azure and the transport) and Jackson (us and S3 share the version here) classes with those already loaded in the transport/core?

relates #81652

@original-brownbear original-brownbear added >bug :Core/Infra/Plugins Plugin API and infrastructure labels Jul 9, 2023
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Jul 9, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@rjernst
Copy link
Member

rjernst commented Mar 1, 2024

Sharing with core isn't really possible. We decoupled these intentionally: dependency versions used by plugins should match those dependencies intended versions, not what we happen to use. Having those versions tightly coupled in the past caused headaches for upgrading (we couldn't upgrade jackson for a long time because of azure). Additionally, since we now have hidden jackson inside the x-content jar, there's no easy way to do this (a dependency of server).

We have discussed in the past (though I could not find an issue for it) building some caching of plugin dependency jars automatically. It's still possible, but we would need to be careful it's based on jar hash and not just the jar filenames.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Plugins Plugin API and infrastructure Team:Core/Infra Meta label for core/infra team
Projects
None yet
Development

No branches or pull requests

3 participants