Heimdall icon indicating copy to clipboard operation
Heimdall copied to clipboard

Constant and periodic CPU load

Open dontevenblink opened this issue 5 years ago • 21 comments

Heimdall is exhibiting unusual and periodic CPU load on my system.

In the first image the chart starts with one instance of Heimdall open in FireFox. There, about once per second, are pretty substantial periodic CPU spikes. You can see where I close the window and the CPU usage goes flat in the middle. The big spike is when I opened the window again, and the periodic load returns after I clicked on one the the dashboard links.

Screen Shot 2020-07-03 at 11 25 16 PM

It carries on like that in perpetuity as far as I can tell.

Screen Shot 2020-07-03 at 11 29 27 PM

The only processes showing much load during this time, I think, are php-fpm.

Screen Shot 2020-07-03 at 11 29 51 PM

I've got 10 containers running on this box and while this is happening, Heimdall is loading the CPU more than any other container, including an instance of Jellyfin actively streaming 1080p video. What is this process doing? I'm guessing this isn't expected behavior. Anecdotally, a friend of mine is observing the same of his heimdall instance. There was an issue that looked similar a while back, but it appeared to be closed without any resolution.

dontevenblink avatar Jul 04 '20 03:07 dontevenblink

I am also seeing high cpu usage coming from this container.

jes1417 avatar Jul 20 '20 00:07 jes1417

This happens when you have enhanced apps configured and they're communicating with the API's to get stat updates.

j0nnymoe avatar Jul 20 '20 08:07 j0nnymoe

This happens when you have enhanced apps configured and they're communicating with the API's to get stat updates.

After some testing, this issue does seem enhanced API related. The Transmission API seems to be a particular offender. While we should expect some CPU usage from these APIs, this doesn't seem like expected behavior - Heimdall communicating to the Transmission API seems to consume a lot more CPU than Transmission itself. As stated above, when I have three APIs going (Transmission, Jellyfin, and Pi-hole), Heimdall consumes more CPU than any of those containers do, maybe even combined depending on what they're doing.

EDITED for clarity

dontevenblink avatar Jul 20 '20 19:07 dontevenblink

One question though - why Heimdall keeps polling those APIs when it has like zero open client connections? I'd normally expect it to only poll those APIs when there's actually a user looking at the Heimdall UI. I doubt that many of us keep staring at the UI for hours, rather than just opening it, clicking on an app tile and going on our ways.

TheTinkerDad avatar May 07 '21 12:05 TheTinkerDad

Same issues here, looking at the dashboard vs not looking at the dashboard: dbd4fcef-474a-4688-863b-3fbc1abea014 2a8988d2-93d5-46ef-bd04-852e2373d0d5

Xitro01 avatar Nov 16 '21 12:11 Xitro01

Same problem here..

Whenever APIs are being used and depending on how many are used on the dashboard, the CPU usage can jump above 50% usage when the dashboard is displayed. From my understanding this is happening because there is a constant pulling of information from all the APIs.

I have tried to find a global refresh setting or per app refresh setting but there doesn't seem to be any.

In order to help diminish the CPU usage, perhaps it would be a good idea to introduce a global refresh setting and one per application that overrides the global setting so that we can configure how often the data is being pulled in milliseconds or seconds.

tessierp avatar Dec 03 '21 03:12 tessierp

Same problem here using the latest docker image on RBPi Ubuntu

djcrawleravp avatar Dec 28 '21 03:12 djcrawleravp

same high CPU usage here: image

I have 5 "enhanced API" plates.

Def3nder avatar Jan 05 '22 13:01 Def3nder

Can someone recommend me the best previous tag?

djcrawleravp avatar Jan 06 '22 21:01 djcrawleravp

It seem little bit absurd that a page with bunch of links is taking so much cpu. I had to stop the container because my server was almost flying off with its fans spinning at their max due to the heimdall. I think in my case that the extra high activity was caused by heimdall + qbittorrent. It seems heimdal does not play nicely with the torrent clients.

@Def3nder can I ask something offtopic - what tool generated this cpu screen? looks cool.

nedich avatar Jan 19 '22 23:01 nedich

It seem little bit absurd that a page with bunch of links is taking so much cpu. I had to stop the container because my server was almost flying off with its fans spinning at their max due to the heimdall. I think in my case that the extra high activity was caused by heimdall + qbittorrent. It seems heimdal does not play nicely with the torrent clients.

@Def3nder can I ask something offtopic - what tool generated this cpu screen? looks cool.

Yeah this app needs optimization for sure..

As for your question about the graph, looking at the image I saw NETDATA mentioned and searched and found this : https://www.netdata.cloud

If you are using Docker, you can install the container : https://hub.docker.com/r/netdata/netdata

tessierp avatar Jan 20 '22 01:01 tessierp

It seem little bit absurd that a page with bunch of links is taking so much cpu

If you use it strictly as a page with a bunch of links, it will use hardly any cpu cycles. That means you have to disable all the enhanced app features like displaying stats inside the buttons. Those stat gathering operations are what use up cpu cycles.

aptalca avatar Jan 20 '22 02:01 aptalca

Hi, that we know. But it shouldn't take as much CPU power as it does.

tessierp avatar Jan 20 '22 02:01 tessierp

I just checked mine with docker stats heimdall and when heimdall is not open, the cpu usage is at a constant 0%.

When I open heimdall in a browser and keep it in the foreground, I see cpu usage fluctuating between 0-9%. If I switch to another tab in chrome, usage drops to 0% with spikes every so often. If I close the window, it drops to constant 0% again.

I have 18 buttons, 9 are enhanced.

I use heimdall as a browser homepage, so I don't have heimdall open for long periods of time. The 0-9% usage while open never bothered me (I didn't notice until I specifically checked).

For each enhanced button, it's running a php script that makes at least one (for some more than one) call to an external app's api and processes the results once every second, and updates the display. The more enhanced buttons, the more scripts, calls and processing.

aptalca avatar Jan 20 '22 02:01 aptalca

While what you say is technically true, it should not spike as high as it does. I have way less than that and yet usage spiked to above 47%. This causes my CPU to warm and my fans to turn at a higher regime. This is not the only other application I am running on this system and none of them take up that much CPU. Well there is PLEX but that is quite understandable.

As a reference, I'm using ZABBIX which collects data from many systems, CPU temps, network bandwidth in and out, and more and it doesn't use that much CPU.

The fact you do not have any issues doesn't mean there isn't any issues.

tessierp avatar Jan 20 '22 02:01 tessierp

I didn't say there aren't any issues. I just shared my use case and results, which may point to an issue with a specific enhanced app that maybe you're using and I'm not.

Anyway, I'll bud out.

Good luck.

aptalca avatar Jan 20 '22 03:01 aptalca

Thanks for sharing. Hopefully the devs find a solution.

tessierp avatar Jan 20 '22 03:01 tessierp

It seem little bit absurd that a page with bunch of links is taking so much cpu

If you use it strictly as a page with a bunch of links, it will use hardly any cpu cycles. That means you have to disable all the enhanced app features like displaying stats inside the buttons. Those stat gathering operations are what use up cpu cycles.

@aptalca yes, if you disable the enhanced apps then this peaks are gone, but then I could just use a static html-page and would not need heimdall. Other containers like this (e.g. DashMachine ) do offer similar features and the use below 0,1% of the CPU - Heimdall goes up to the 35% of the CPU.

@Def3nder can I ask something offtopic - what tool generated this cpu screen? looks cool.

Yes, this is the default dashboard from Netdata.

Def3nder avatar Feb 02 '22 09:02 Def3nder

Looks awesome.. Too bad DashMachine hasn't been supported in 2 years. I mean still good, but I guess it is not longer being worked on.

tessierp avatar Feb 02 '22 14:02 tessierp

Though I'm not the Dev of Heimdall, I doubt any fixes will be done for this as focus shifted over to a rewrite a number of months back: https://github.com/linuxserver/heimdalljs

It's worth checking out as to my knowledge, it's all there apart from the pre configured enhanced apps but you can manually do them yourself within the GUI.

j0nnymoe avatar Feb 02 '22 14:02 j0nnymoe

Well, could be a good thing is they are doing a rewrite.. Thanks for the info!

tessierp avatar Feb 02 '22 14:02 tessierp

Should be resolved with: https://github.com/linuxserver/Heimdall/pull/1059

keriati avatar Dec 15 '22 22:12 keriati