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

[agentbeat/linux] shirou/gopsutil causes high CPU usage #39253

Open
florianl opened this issue Apr 29, 2024 · 6 comments
Open

[agentbeat/linux] shirou/gopsutil causes high CPU usage #39253

florianl opened this issue Apr 29, 2024 · 6 comments
Assignees
Labels
beta A beta input Team:Elastic-Agent Label for the Agent team Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Comments

@florianl
Copy link
Member

agentbeat uses shirou/gopsutil to fetch network information.

When testing a current release, the following profile from agentbeat was collected.

20240426-091526

From this on CPU profile, agentbeat spends most of its CPU resources on traversing /proc/net and /proc/<PID>/net in order to read files to fetch networking information.

Long standing issues on shirou/gopsutil to address performance issues when collecting network information:

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Apr 29, 2024
@florianl florianl added Team:Elastic-Agent Label for the Agent team beta A beta input labels Apr 29, 2024
@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 29, 2024
@pierrehilbert
Copy link
Collaborator

Thx @florianl for your feedback.
Did you observe a worse behavior than standalone Beats or are we having the same CPU consumption?
cc @blakerouse

@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Apr 29, 2024
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@florianl
Copy link
Member Author

florianl commented Apr 29, 2024

It is hard to compare the standalone agentbeat with a collection of multiple beats. Before the change to agentbeat each beat was more independent and could use its available resources. Now all resources are channeled and internals of agentbeat are competing with each other for these resources. From that perspective, I would say, the behavior is worse than before.

@cmacknz
Copy link
Member

cmacknz commented Apr 29, 2024

Interesting, we haven't changed the number of processes (and in theory the work done by those processes), only the executable used to implement those processes.

@blakerouse
Copy link
Contributor

As @cmacknz please compare this to native to metricbeat, because the number of processes and the work each process does has not changed.

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

No branches or pull requests

5 participants