My HA installation response was getting slower and slower over the past few days, but rather than take the time to try one fix at a time, I simply did the shotgun approach.
A few months ago I moved my Home Assistant from a Raspberry Pi3 to an Intel Nuc running Ubuntu. The new speed of response blew me away. Change configuration.yaml and restart- 5 seconds and my HA UI is back. I installed Node-Red from the add-on store and moved most of my Node-Red flows. Same jaw-dropping speed. I make a change to a node, hit Deploy, and in one or two seconds, the deploy is finished.
But for the past few weeks, everything just kept getting slower. Opening Node-Red was taking tens of seconds. A deploy would take up to a full minute. MQTT publishes from Node Red or from an MQTT sensor took seconds.
So, like I said, I took a shotgun to the problem.
Here’s what I did:
Stop Home Assistant
Delete home-assistant_v2.db (1.7gb) from my config folder.
Reboot the host computer.
Now, my system speed is back.
So, would any of the above steps alone have fixed my sluggish system?
Is this degradation of system response normal?
No it’s not normal. Maybe you can take a screenshot of the htop command when HA is idle and save it as benchmark? Whenever HA gets sluggish see what htop has to say and compare.
This is quite huge. Did you configure the history and recorder component?
May be a reason for the performance slowdown as well.
I also use an Intel NUC running Ubuntu in a VM and I didn’t restart my production HA for 2 months now. Everything as snappy as on the first day. I migrated the HA database to MySQL and whitelisted only the entities for which I need the history. I don’t need any history about the sun’s state or the time for example.
Htop shows all processes running on your computer (RPI). It shows how much memory every process uses and how much CPU it uses. If you see a process using Al your memory which didn’t use all that memory you can pinpoint the problem a little easier.
I restart my Home Assistant 3027498732489632568 times, but only while creating new stuff
When I don’t play around I have it running for months without performance degration. And I never deleted any db file ^^ Only thing is that when I restart my router it sometimes looses some connections, a quick HA restart solves them all.
My MySql recorder database has purge_keep_days: 7 and size is around 1gb. Haven’t even excluded anything from it. So 1.7gb sounds really big. My experience from Raspberry was, that the database size was always the most probable reason for sluggish performance. And with NUC now you can still see some sluggishness when any history is being processed.
Are you using any bluetooth sensors? Especially btle can be really painful experience. But this should freeze homeassistant completely in my experience, not cause performance degradation.