Home assistant using lot of memory after upgrade

I have seen high memory usage on my home assistant after every upgrade. The upgrade restarts home assistant application, but even after the restart the memory usage still remains high. The only way I am able to clear this additional memory usage is by rebooting the instance. I have monitored the last few upgrades in October and this was the same behavior.

I am running this on a proxmox VM on HP DeskPro 400 G3 I5 6500T. Home Assistant has 4GB memory and 2CPU assigned. You can see the spike during and after the upgrade. The usage came down after a reboot.

1 Like

Updates can contain database updates that have to run through the entire database and maybe several times.
This can take hours even on faster hardware.

4 Likes

I had a similar problem after the update, did you find any solution? memory is used by homeassistant os, before the system did not use so much memory. It’s been running like this for 2 days. Today I deleted the whole database, after reboot it runs normally for a while, then it stays above 70%.


I reboot the OS and memory gets cleared immediately. Haven’t done anything else. Restarting home assistant doesn’t help.

IT’s not so long ago, a rebuild of the DB was made, following by “Tweaks”, to reduce writes to Disk, and reduce CPU-Usage
Such Tweaks, is also called “House-Holding” i.e why writes to disk, and use CPU, when you can “hold” certain Datas, in the Memory.
So Most OS’s obviously checks ( How much Ram am i Provided with ?, ok, 4GB, … lets use an average(or slightly above) ) , OR the OS discover ( Cool, i got 8 GB, …lets use an average(or slightly above) )

Does any of you have any problems or worries related to your “known” findings ? , or is it seeing such graphs/statistic which “worries” you ?

If you haven’t got any performance issues, you should just be happy that the also Mentioned in release notes previously, seems to work just fine.
I Mean it’s not like the 1 instance with 4GB ram, is hitting the top all the time, looks very stable below 2GB, causing less writes to disk, and less CPU-usage
And the 1 with 8GB, you most like have a few more “memory consuming” integrations running, instead of a Huge amount of read/writes to disk, by the CPU, and yet it doesn’t seems like your instance is constantly “hitting the roof”

I have also , or do often keep an eye on CPU/MEM, and as Wally Mention, after each update, there is a slight increase, which use to settle down, but ofcause it can also be do to a “Specific use-case”

NON of you have mentioned which HA install you got, nor which Integrations/ ADD_ONS , and/or How and What you use your HA-Server for.
Only providing a picture each is saying Nothing
( 2 hours ago i installed latest-core.11.1, it’s already (Back to “Normal”) … even thou i did encountered some “lack” in the UI, " in RAW-Conf-Editor" when editing a 1500 rows view/dashboard, no idea yet whether it’s do to latest update, or i just have to much “streams” etc. in this view

I haven’t really seen any issues, its just the high memory consumption close to the maximum allocated 4GB which never drops worried me.

One of the database tweaks were actually a decrease in writes by storing more data in memory.

2 Likes

You are aware that your “used” memory is the blue in your pic right ?, Below 2 GB, and a “Natural” top during Installation/configuration of an update, then back to below 2GB., there is nothing strange/odd in this
You have an “Installation” whe, re the OS-Core-Supervisor is build to “work together”
So unless you don’t have a tons of add-ons/integrations, and bad configurations(here and there), which causes “Tops”, then you have nothing to worry about.
It’s a total natural “Top” you are seeing … If you have a windows machine, open the Task-manager and “watch” when you click “install updates” or Open a browser with 5-10 tabs, or other memory/cpu craving “tasks / Programs”

You can actually do the same with your HA-Installation, i.e open 2 tabs/or on 2 differrent devices, in 1 you monitor the CPU/Memory, in the other(2) , you i.e. click, install add-on/integration, or “shoot-of” a resource-craving scrip/template ( if you have such ) , or do a Full-Backup
Then you get an idea of how your “system” work in these cases, and would have better ideas of what would be of interest for the People you hope responds from

Open a post ( With the Topic-Header as this) , and with a pic of a total normal behavior, and without any other “Specs ( ha setup, including add-ons/integrations etc) ./ use-case”, doesn’t make any sense

PS: What means “never drops” ?, the pic shows it does, for how long time did you “monitor” a TOP which didn’t drop ? , you have to “Watch” not just “check-in and look” and then “check-in” again later, Watch, 10-15 min ( meaning having the TAB open, all the time, where you run your Hardware-Graph Running )

No, it wasn’t back to 2GB. If it was, then it’s normal.

I had to reboot the VM for it to be back to 2GB. With the previous updates as well, until I reboot the VM, it was stuck close to 4GB. Doesn’t feel like normal behaviour.

I did monitor after atleast 1 day with the previous upgrades, but don’t have screenshots.

Ok, i can’t ofcause not say what caused this, and as i have as routine to reboot quit often (often after major updates) i also can’t say whether past months updates has/had an “impact” as you describe.
It’s a fact that HA is “developing” quite fast, with “major” changes/enhancements, so i believe it’s still a good idea to Reboot (even after an “automatic” Core/Supervisor Restart ) , normally i check the “logs” first before deciding whether to perform an additional Reboot

With i.e my Windows systems, i always Reboot(ones again) even if windows already “Rebooted” do to an update, because after such updates alot “new” configurations/changes etc. is made(implemented), after the automatic/required reboot/restart.
And i prefer my system to “start-up” without alot of “strange” errors/warnings :slight_smile: ( Often caused by the fact that some changes is not “configured/changed” before such “restart” ), so a total Reboot( after the Restart ) use to “clear” the logs, and pleases my worries/conserns :slight_smile:

No issues rebooting. Just wanted to check if I may have some misconfiguration causing this. Looks like I am not alone. So should be ok. Just wanted to post results after today’s update to 2023.11.2. The spike at 2:30pm never came down to the usual utilisation around 2GB.

:frowning: yeah that dont look right

Have you found you log-files ?, and maybe tried to enable DEBUG in Logger ?

I think the last update helped me, specifically core 2023.11.2. Memory doesn’t go to 100% anymore, it seems to stay normal. This is my 1 week old log… I am on raspberry 4, 8gb ram with ssd


I started noticing memory-leaking behaviour after upgrading from 2023.10.3 to 2023.11.1 or 2023.11.2. Running on rpi3 with 1GB ram noticed regular crashes. Downgrading back to 2023.10.3 resolved the issue immediately.

1 Like

Lots of nice pictures you are posting

Have any of you tried to look in /Setting/System/Logs ?
Have any of you tried to enable Default “DEBUG” in Logger ?

READ this first !
How to help us help you - or How to ask a good question.

Then this.

… or just look keep “looking” at your graphs

1 Like

Funny after installing my new Proxmox and updating two versions in HA i noticed high memory usage on proxmox

a reboot direktly solved it.
i will enable Logs on the next Update.

Something I wanted to clarify for some time and now I have a bit of time to clarify. There is a difference with how HAOS and PVE report memory usage.

Under HAOS you only get the actual memory usage of the system excluding buffer and cache.

Under PVE you get the full amount of memory allocated including buffer and cache. Cache can be in RAM but can also be on disk and usually consumes a considerable portion of RAM allocated to the VM.

I will provide an example with 8G RAM.

image

PVE reports 4G of RAM used which is true, but it is not all consumed by HAOS.

This is what HAOS reports. So where is the rest of memory, 3G in our case, gone?

image

To find out use top under Terminal in HAOS. You get something like the below. Of 4G used, 7M is shared, 300M is buffer and 2.5G is cashed

image

So when you reboot the VM you have a clean and reduced size cache. If you see memory use going up in PVE in most instances you have to increase the memory allocated to the VM as it wants to expand its cache. For example if you have 2G allocated, increase to 4G. If you have 4G increase to 6G. Reported memory utilisation under PVE means, your installed add-ons and HACS integrations require more RAM to run at optimum.

Increased memory utilisation in most cases should not worry you, you just have to allocate more RAM to the VM if possible. If not possible, the system will expand its cache onto disk. In rare cases increasing memory utilisation over time, especially if exponential, could mean a process is possibly not managing memory well.

1 Like

Great explanation! Going to bookmark this post because this question is asked at least once a week.

How are you capturing those awesome looking graphs? I am a total n00b and love the look of those!

You require HACS and then download mini-graph-card

1 Like