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

Glances CPU usage grows over time #1341

Open
LrrrAc opened this issue Oct 27, 2018 · 16 comments
Open

Glances CPU usage grows over time #1341

LrrrAc opened this issue Oct 27, 2018 · 16 comments

Comments

@LrrrAc
Copy link

LrrrAc commented Oct 27, 2018

I use the docker version of glances and love it, but the CPU usage grows over time. I need to restart the containers which then lowers the usage. I have recreated the container to no avail. No other containers do this. This is on Ubuntu 18.04 and the latest docker image of glances. I can upload pictures of the usage, but it just slowly increases until I restart it so it seems unnecessary. Any help would be appreciated.

@nicolargo
Copy link
Owner

In the past i have some issues (resolved) with the RAM consumption but never with the CPU. I will make a long perf test on my side.

@nicolargo
Copy link
Owner

Here is my result after a 24 hours test:

glances-cpu

CPU consumption increases from (+2%) and the RAM from 3 to 17 MB.
I can explain the RAM (Glances stores stats: Default is 28800: 1 day with 1 point every 3 seconds). And it can also explains the +2% for the CPU.

Do you have the same behavior on your system ?

You can also try to reduce the history_size in the Glances.conf file.

@LrrrAc
Copy link
Author

LrrrAc commented Nov 2, 2018

Here is a graph from the past six hours. Its been running uninterrupted for well over that. capture
The percentage I believe is per core, so the 100% is only 25%, so it doesnt increase all that much anymore, it was much more drastic about a month or so ago, but it still increases quite a bit more than 2% per day. My ram usage seems to track that increased amount as well. Ill lower the history size as I only use it to push data to influxdb and it doesnt need to keep history itself.

@LrrrAc
Copy link
Author

LrrrAc commented Nov 2, 2018

capture
Here is an older, more drastic increase, including a restart on my part.

@nicolargo
Copy link
Owner

@LrrrAc Have you try to reduce the history_size in the Glances.conf file ?

@LrrrAc
Copy link
Author

LrrrAc commented Nov 10, 2018

How would I go about doing that?

@jcaude
Copy link

jcaude commented Nov 19, 2018

Same issue for me, I will check if the memory size also increases.

@jcaude
Copy link

jcaude commented Nov 22, 2018

I also observed an increase of memory consumption ...

CPU%   MEM%  VIRT  RES      PID USER          TIME+ THR  NI S  R/s W/s  Command
 8.5    0.0   370M  28.1M 150570 XXX	      0:01 1     0 R    0 0    python /usr/local/bin/glances
 9.1    0.1   494M  152M  150570 XXX	     53:15 1     0 R    0 0    python /usr/local/bin/glances
 24.0   0.3   763M  420M  150570 XXX	   3h22:14 1     0 R    0 0    python /usr/local/bin/glances
 25.7   0.3   762M  420M  150570 XXX	    8h1:26 1     0 R    0 0    python /usr/local/bin/glances

@nicolargo
Copy link
Owner

@jcaude As already said, increase of memory is a default behavor because Glances store all the stats for a couple of hours. If you have a look on yours stats, you can, it did not increase between 3h22 and 8h1.

If you want to reduce the memory footprint, change the history_size option in the Glances.conf file

@nicolargo
Copy link
Owner

nicolargo commented Nov 24, 2018

@LrrrAc Edit your glances configuration file (https://glances.readthedocs.io/en/stable/config.html or https://github.com/nicolargo/glances#docker-the-funny-way for the Docker installation) and change the following line:

history_size=28800

to

history_size=0

than restart Glances.

@jcaude
Copy link

jcaude commented Nov 24, 2018

Thanks and I will set the configuration file accordingly. Still, that doesn’t explain why the cpu usage increase to such extent.

@LrrrAc
Copy link
Author

LrrrAc commented Nov 26, 2018

I have a configuration file, but it was made myself and didn't have a history size option. I added it in, but it hasn't affected anything. The other settings I've used all work. It sends data to influxdb as normal.

@LrrrAc
Copy link
Author

LrrrAc commented Nov 29, 2018

Just figured it out. Replaced the config file I made with the one on the github page and modified the history size and so far at 24 hour it doesnt seem to be increasing at all. Thanks for all the help!

@AndyKassell
Copy link

Same issue, running in Docker and sending info to InfluxDB. However it seems when memory stabilises (presuming history recycling) then the CPU usage doubles. This is running with process info off. Have not yet tried History = 0 will do so.

glanesissue

@LrrrAc
Copy link
Author

LrrrAc commented Apr 7, 2019

So I have not growing cpu usage, but when the container I run glances in is started, it can run at either around 100% of a core, or 50% of a core. I can restart it enough times to get either option, but dont understand why it will potentially double its cpu usage for apparently no reason. Ive restarted the container 10 times and so far its a 50/50 chance. @nicolargo

@LrrrAc
Copy link
Author

LrrrAc commented Apr 7, 2019

Capture
Here is a graph of me restarting the container every 2 minutes for an hour. Its 100% 17 times and 50% 14 times out of 30.

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

4 participants