High CPU Usage how to narrow down source

Suddenly as of a couple of days ago my Intel NUC has CPU Usage of around 55-65 percent. It normally sat around 10-15 percent. I had made some changes to my Ubuntu Desktop environment around that time but have since reverted those changes thinking that’s what caused it. (It is possible it had been doing it prior to that but I hadn’t noticed )What is confusing me is that in HTOP is it’s the hass process that has insane CPU usage. Sometimes 104-120 according to HTOP. Stopping Home Assistant leaves that process running… i also cannot figure out which component may be doing it as I have turned things off/removed integrations and it is still doing it. What is even more confusing is that it has randomly stopped doing it but then when I looked this morning it had started again.
Is there anyway to see specifically what “thread” or process in HA is causing this? I think my next stop is to create a new “test” environment but the problem with that is that other thread/process still lingers after I stop home assistant even with systemctl stop.

If stopping home assistant does not reduce the use then it’s one of your addons (assuming you are using hassio).

Portainer has the ability to monitor the stats of containers and will tell you which one is at fault, or you can just disable your addons one by one until you find the culprit.

No just regular HA (I don’t know the proper name) in a VENV

Python 3.7
Lubuntu 19.04 (updated in a hope it would somehow fix) was at 18
Intel NUC DN2820FYKH (I know it’s old :frowning: )
4g of ram
120GB SSD
HUSBZB-1
Running HA 0.95.4

Not sure what other info would be helpful…

Are you using ffmpeg / streaming?

Yes I am using but have been since for over a year (and streaming since it was released)… I did not try turning that off as my CPU load was still low with that previously maybe goes up about 5-10 when I load my camera page… I will gladly try turning that off though…

Also the HUSBZB-1 is kind of new but didn’t notice anything (using about a week) and also didn’t think that was it since I was getting those random multiple hour periods where it went back to normal. This morning I removed the stick and rebooted and it was the same.

Removed cameras from config… still same

It’s only a hunch but I’d start by disabling streaming. I’ve seen it completely lock up a few people’s servers.

Oh well so much for that idea. Did you remove ffmpeg too?

Mqtt is the only other cause of high cpu use I’ve seen reported recently.

Well I just removed all of the camera section from my config … let me try the stream and ffmpeg line also … (I just assumed not having any cameras to connect to would have done it)… but I know what assuming does…

So in looking at HTOP again I noticed that even after 4 restarts of HA that one that is eating CPU never stopped… look at the run time?? I’m going to try manually stopping and starting again…

… well after hacking chucks of my config away to no avail… I started working on integrations… picked PS4 first because I noticed an error… (get them all the time but integration still worked)… back to a much more reasonable level… hopefully that was it…

11%20PM

1 Like

iotop is a useful tool. It should show you if a process is hogging disk IO, which may give a clue.