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

High memory usage on elastic agent #35234

Open
mistic opened this issue Apr 27, 2023 · 6 comments
Open

High memory usage on elastic agent #35234

mistic opened this issue Apr 27, 2023 · 6 comments
Labels
Team:Elastic-Agent Label for the Agent team

Comments

@mistic
Copy link
Member

mistic commented Apr 27, 2023

A friend of mine using the elastic agent reported to me an unreasonably high memory when using the elastic agent.

The following is the feedback that came up as a result from a little investigation they ran:

The registration strategy used in beats means we perform package initialisation for all modules at startup, and this means it walks into the vsphere packages at startup - that 40mb one uses a serialization/deserialization preparation pattern that means it executes tons of code over all of it's types to generate plan tables in package init, which also means it has to bring all that stuff into the heap on startup - this almost certainly contributes very significantly to startup performance too. Ousting that module cuts 10% of the rss requirement for printing --help from the program

In addition the "add fields" processor depends on the scripts processor which depends on a WIP javascript runtime written in go, that round-trips through json a couple of extra times.

I believe this is something that is worth it at least to get checked so I'm opening this issue here.

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Apr 27, 2023
@ycombinator ycombinator added the Team:Elastic-Agent Label for the Agent team label Apr 27, 2023
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Apr 27, 2023
@pierrehilbert
Copy link
Collaborator

@alexsapran putting this in your radar.

@alexsapran
Copy link
Contributor

Thanks @pierrehilbert 👍🏼 .

Reading about this issue, I was wondering if, @mistic could share the configuration (or part of the configuration) of what your friend tried as well as what version of elastic agent he was using, what OS, and what methodology he used to test this.

@cmacknz
Copy link
Member

cmacknz commented Apr 27, 2023

The way Go initializes dependencies is the major factor here and is well described in grafana/alloy#529, where it also affects the startup time for services with many dependencies.

CC @andrewkroh, since we were just talking about the memory usage of the agent and this seems to be one contributing factor.

For @alexsapran what we would need from our performance testing is to capture the memory usage for each test, and ideally capture heap profiles in addition to CPU profiles.

@mistic
Copy link
Member Author

mistic commented May 4, 2023

Thanks for paying attention to this team! @alexsapran do you still find the info you mentioned previously as needed?

@raggi
Copy link

raggi commented May 11, 2023

See raggi@f069ddd for an example, this cuts the rss substantially

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

No branches or pull requests

7 participants