CPU jumps up to 100% every day at 4:10am

For the past week or so my HA docker instance jumps to 100% CPU at around 4:10am every morning and it stays there until I restart the container. I recently upgraded to 2021.4.6 but I’m not sure if there’s a direct correlation. I don’t have any (intentional) automations that run at this time.

I just upgraded a few minutes ago to 2021.5.0 so we’ll see if it happens tomorrow but if it does, what’s the best way to go about debugging this? Nothing in the home-assistant.log gives any indication that anything special is happening around that time.

Thanks!

Backup running at that time?

Is that something that’s configured automatically? I don’t remember ever setting that up.

Recorder integration Automatically purge the database every night at 04:12 local time.

2 Likes

Ah, that must be it. Thanks! I’ll troubleshoot from there.

So it looks like the purge is getting stuck. I called the recorder.purge service letting it run for an hour and the database size never shrunk but it sat there at 100% CPU. My db is massive (55GB) so I’m guessing that may be the root cause. I recently added the Unifi integration which means it added an additional 300 entities. I think I need to look into offloading to a better db (and trimming down what it keeps).

Mine is less than 1Gb and purge is taking few min with CPU less than 50%. I use MariaDB, its more reliable than default. Its set to retain 7 days with some things excluded.

1 Like