Running HA 2023.3.4 on OrangePiOne+ (aarch64, 1GB, 1gbit ethernet), Ubuntu2210, docker. Moscquito + z2m + NUT run elsewhere. HA locks up for 5+ minutes several times a day. Profiler says HA spends 77% of time in poll() (if I am reading it right, the picture below), memory profiler just makes everything worse and never seems to finish.
home-assistant_v2.db was 520MB, I removed it and -shm and -wal, restarted HA, this used to help but not anymore. home-assistant_v2.db-wal is 3.5MB after half an hour of HA running.
iotop says 6…11MB/s “current disk write” and it is none of the apps so I assume it is swapping. HA, swap and /tmp are on USB2.0 attached SSD, not SD card. With disabled swap, OOM would just kill HA every hour or two. Only about 750MB of swap is used, and this number is not growing, “available” in “free” says at least 40MB is always available. /me puzzled. /tmp in RAM is disabled.
I was wondering if there is a way to limit RAM use by tweaking the recorder/logger/docker/etc?
Or this is it, a newer bigger Pi is needed?
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
7e6986c89239 homeassistant 40.88% 307MiB / 985.1MiB 31.16% 0B / 0B 426MB / 99.1MB 33
The earlier output showed that HA is only responsible for 31% of that, and the top output says 38%. It’ll be interesting to see where the rest went… sort top by %MEM.
There was tmux as well, consuming 150M. I stopped it, run memory profiler in HA and this time it hung so bad that I could not ssh to it anymore, had to reboot.
I doubt there is an “expected RAM use” documented like that. Even with that though, less than half your RAM is being used by HA (according to what you shared).
If you’re using stream and have Preload camera enabled (which may even be the default) then that’ll increase RAM and CPU usage. For 7 cameras potentially by quite a lot.
The kernel logs should tell you more about what’s going on, if it’s invoking the OOM killer for instance, but if swap is going up then that’s a bad sign.
Without swap, OOM was invoked a lot. But 1yo HA did not have this problem. I was not streaming video buuuuut those static images were opening very quickly so this may be related.
btw where should this option appear? I cannot find it in the UI, is it a camera’s option, or “stream” integration option(and then it is configuration.yml)?
upd: 1 onvif camera with the defaults consumes at least 70MB of RAM. So in my case 70*6 = 420MB which puts the setup on the edge (it is 6 onvifs + 1 android ipcamera, not 7 onvifs).