High CPU usage since December, how can I check what is causing it?

Hi,

Since December, my CPU usage has increased by a factor of 6. After a reboot, it briefly drops to normal levels, but then increases and stays high.

It’s been a long time since I made any major changes to HA or added anything new, certainly longer than December.

Is there any way to check what is causing the CPU usage?

This is the CPU usage from August to today. It went up from 5% to 30% in mid-December.
image

2 Likes

Due to the high CPU use it is probably not this, but if you use the CPU Speed integration it may be worth checking.

Otherwise, start disabling integrations one by one (third party integrations first) until you find which has an effect.

Also try reloading automations to make sure it is not a rogue loop.

1 Like

Unfortunately that’s not it.
Is there no way to check the CPU usage and see what’s causing it? I’d like to avoid disabling one integration at a time.

Yes there are a couple of ways but they are not easy to interpret.

Profiler Scan (this will work better after 2024.2 is released with Python 3.12 support as it will show the thread info). But is still worth trying now:

Also Py-Spy.

Run the scan and ask for help interpreting the results in this topic if you need it:

1 Like

The profiler looks very interesting. As we are only a few days away from 2023.02, I’ll just wait for the update. After all, it has been running like this for over a month now.

I’ll come back here and let you know if it helped when the update is released.

Thanks for the quick answers!

I have found out what is causing the CPU load. After doing a backup, it jumps from 5% to 30% CPU load and stays there until I restart HomeAssistant.

I run HA as a VM in Proxmox and do daily backups. I’ve tried snapshot and stop mode but it happens both ways.

Is there anything I can do about this? Is it possible to create a rule in HA to reboot at a set time?

Rather than doing that report the issue so it gets fixed.

1 Like

Hi Boerny,
I would be curious how you finally solved this issue. Same phenomenon on my side. Many nightly backups go well but every now and then there is one where the CPU load stays at around 30% in my case. Usually it’s around 1%. Only a restart of the entire system does help, than the CPU load is back to 1% again. I do daily backups during the night. After a week or so the CPU load stays high, even if the backup job is finished. I trigger the backup with an automation rule.
Cheers

I am also finding this to be the case, due to Proxmox backups. I check the HASS VM cpu stats in Proxmox , and the container CPU spikes right when the backup begins within Proxmox. But then it never reduces back to normal. Also finding if I have a browser open with a HASS tab, the browser cpu spikes and stays running high too. It is only resolvable by restarting the entire HASS container within Proxmox.

Even stranger (to me) is that when I use Glances to investigate the CPU usage, it appears to be “python3” as the culprit of high CPU usage. But again, this never happens until the Proxmox backup happens. Perhaps some Integration goes on a runaway loop while Proxmox is freezing certain files for backup, idk.

1 Like

Never solved it. Just told HA to restart every night.

Same thing is happening to me, also running HA on proxmox and using proxmox backups:

Funny thing is, that HA doesn’t recognize it:

89% cpu what’s wrong i can’t find it

Having the same issue for about a month or so. Every time I access the dashboard from an iOS device the cpu goes to 100%. It is with the app and also with Safari. If I think of it now, it does not happen when I access HA from my Windows laptop at work.

Maybe Safari or webkit creates the high load?

Apparently, when I reboot the Studio Code Server add-on after the HA restart, the cpu drops back to low cpu

2 Likes

Replaced the automatic restart of HA with a restart of VSCode add-on and can confirm that the cpu usage goes back down after it restarts.

Seems I’m having the same issue. Not sure what’s causing it.

For more than a year I had this issue as well. Python3 process spiking to use all CPU on the system after 2 hours (Intel Nuc / Home Assistant OS several versions).

Restart of HA brought CPU usage down to normal levels and then again after a few hours it started rising again. Disabling add-ons and HACS components did not help.

I had a work around for a while, where I automatically restarted HA every 2 hours…

Solved
I finally figured out that the reason is an old iPad used as a dashboard through the HA app. It is always on and constantly displaying a camera feed, a few graphs and sensors. When the iPad is turned of, CPU is back to normal…

I have exactly the same issue started around November 2024.
HA is installed on Odroid N2+.
CPU temp will get high after using the HA mobile app.

I’ve spent days chasing down high CPU usage and temperature problems on my Home Assistant Yellow, and have found it has been caused by the 3 x iPads I have running dashboards through the HA iOS app showing live hi-res streams from my Unifi cameras.

I dropped the feeds down to low-res and the CPU returned to normal.

For a while now VS Code has been the problem in my setup

docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}"

NAME                          CPU %     MEM USAGE / LIMIT
addon_a0d7b954_vscode         102.82%   632.5MiB / 3.7GiB
addon_a0d7b954_phpmyadmin     0.01%     25.76MiB / 3.7GiB
hassio_supervisor             0.07%     92.65MiB / 3.7GiB
hassio_audio                  0.90%     3.008MiB / 3.7GiB

Ever time HA becomes slower and unresponsive, the VS Code container is >100% CPU. Not sure what causes this. No clues were found in the VS code logs.
Update: just found this issue which could be responsible for the high CPU:
# Out of control CPU while using #800

1 Like