Swap and disk high usage?


After 3 days of running HaaS on PI4/2GB statistics show that about 50% swap is in use while RAM utilization is about 52% and CPU is running n 12-14% utilization all the time.

My question - is this normal? Will this led to the degradation of SD card? I do have high performance 128GB cad, but don’t want to kill it ater a year of usage.

Also, while the DB is just 300GB, disk usage is increasing 1% over 2 days, which I consider quite high. My suspicion is that there are a lot of logs dumped into the disk. I would like to auto delete these logs after a week. How do I do this?

You may want to think about moving to an SSD.

Using a SD cars, remember to set commit_interval to e.g. 30, a feature for the recorder to reduce writes.

I think your RPi have a lot of load, I’m using a number of integrations, have 50 hue integration devices and 80 zigbee using Z2M. My normal cpu until is 2-4%, temp around 50.

I have a total dub size of 1G, running with 32 days of history.

I have removed a few devices from the recorder, as they take up big parts, a example is browsermod, where my iPad ended up being 50% of my total db size. You might have something similar

Thanks for the reply. Where commit_interval is set?

If the CPU load is high, how can I investigate where load is coming from?

Im on my phone, hence no links.

Commit interval is set as part of the recorder configuration. Search for home asssitant recorder" and it will come up. It have a small special box explaning about SD cards.

For better insight on usage, install the add-on called glances. It provide a lot of information.

Assuming you’re using HA OS, it has the default swappiness of 60, which will start using swap pretty quickly. You can see an explanation of this here, including the process for changing it. You can do it on the HA machine after typing ‘login’, but it will not stick after a reboot. Furthermore, in my case of running under VirtualBox and setting it to 10, the swap usage went up regardless over a few days, even though memory use was ~40% of 4GB. So every now and then I free it all, only because it annoys me.