How often do you restart Home Assistant?

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:

  1. Stop Home Assistant
  2. Delete home-assistant_v2.db (1.7gb) from my config folder.
  3. 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.

I did have this in my configuration.yaml when I was on the Reapberry Pi:

recorder:
  purge_keep_days: 1
  purge_interval: 1

But Home Assistant complained, so I commented it out, meaning to get back to it.

What am I looking for?

recorder:
  purge_keep_days: 1   # Keep this
  purge_interval: 1    # Remove this. It has been depreciated. Purge happens every morning now.
1 Like

Thanks, Rusty. I did look at the docs and couldn’t find purge_interval, but I did find auto_purge.

Here’s my configuration.yaml entry now:

recorder:
  purge_keep_days: 5
  auto_purge: true
  include:
    domains:
      - sensor
      - switch
  exclude:
    entities:
    - sensor.date

Maybe that will keep my db filesize smaller than the OS itself.

1 Like

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.

He is running on a NUC as per the first post:

htop is available on ubuntu too.

I know what htop does, I was curious what you would be looking for.

I restart my Home Assistant 3027498732489632568 times, but only while creating new stuff :smiley:

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.

If you want to store long term sensor data, this is pretty handy: https://www.home-assistant.io/integrations/influxdb

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.

Not using BT (yet), so thanks for the warning.

The problem with my Nuc is that I have 2tb of disk space, so ignoring the db size was, at first, painless.

I restart all the time I’ve never had much luck w/ the RELOAD commands in the Dev Tools I almost always restart when trying anything new/changes.

5 to 6 times today, and hangouts still does not want to connect :frowning: