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

1 Like

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.

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?