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 CPU usage #3027

Open
burgerga opened this issue Nov 21, 2024 · 4 comments
Open

High CPU usage #3027

burgerga opened this issue Nov 21, 2024 · 4 comments

Comments

@burgerga
Copy link

Check the bug
Previous issues were closed as solved

Describe the bug
Instead of <5% CPU Usage, I have around 15-25% CPU usage for glances on a Intel Core i3-8100T (running Proxmox)

To Reproduce
Steps to reproduce the behavior:

  1. Install glances on Proxmox using https://raw.githubusercontent.com/nicolargo/glancesautoinstall/master/install.sh (via https://community-scripts.github.io/ProxmoxVE/scripts?id=glances)
  2. Start via systemd service (/usr/local/bin/glances -w)
  3. Open glances website
  4. Observe high CPU

Expected behavior
Observe low CPU

Screenshots
image

Environement (please complete the following information)

  • Operating System (lsb_release -a or OS name/version):
    Proxmox:
    Distributor ID: Debian
    Description:    Debian GNU/Linux 12 (bookworm)
    Release:        12
    Codename:       bookworm
    
  • Glances & psutil versions:
    Glances version:        4.2.1
    Glances API version:    4
    PsUtil version:         5.9.4
    Log file:               /root/.local/share/glances/glances.log
    
  • How do you install Glances (Pypi package, script, package manager, source): https://raw.githubusercontent.com/nicolargo/glancesautoinstall/master/install.sh
  • Glances test:
    glances_issue.txt

Additional context
I have around 30 LXCs running in proxmox, so the processlist is quite long.
How can I further debug this?

You can also pastebin:

@burgerga
Copy link
Author

burgerga commented Nov 21, 2024

Well, I guess this is indeed part of the problem:

processcount  [OK]    0.24868s
{'pid_max': 0, 'running': 1, 'sleeping': 922, 'thread': 2347, 'total': 1091}

But I also get high CPU if I request only CPU and MEM use using the gethomepage.dev glances info widget

@nicolargo
Copy link
Owner

Strange, Glances is now optimzed for CPU consumption (on my PC, it consume ~5% CPU).

Can you try this:

glances --disable-plugin all --enable-plugin quicklook,cpu,mem,swap,load,processlist

@burgerga
Copy link
Author

Then it's between 8-15%, but mostly around 10%. If I remove processlist, and use top in a different shell I can see it does 3%.

@burgerga
Copy link
Author

burgerga commented Nov 24, 2024

Apart from opening the website, I also tried using the API by using the homepage widget, which doesn't use the processlist endpoint (see https://github.com/gethomepage/homepage/blob/a06964dd175fa798fa9189ba1ecd5766bbde543f/src/pages/api/widgets/glances.js) but still causes high cpu... is this triggered by accessing the API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants