HA (and Addons) RAM eater

My HA and the Addons are really consuming RAM.
After 3 days up the RAM is on almost 16Gb.

image

Is there a tool or resource to identify “who” is this RAM devour?

My HA is with the Home Assistant OS running virtualized on Proxmox and I the addons are:

  • Advanced SSH & Web Terminal
  • Frigate
  • go2rtc
  • Matter Server
  • Mosquitto broker
  • Zigbee2MQTT

My Money’s on Frigate or go2rtc, but if you want to make sure, just open the addon page and it’ll tell you how much RAM it’s consuming

EDIT: Realised after I posted that you’re on proxmox (as am I).
Ignore that value you see in the node page. It’s just the way proxmox reports/uses RAM and nothing to do with HA.

If you want to know how much RAM HA is actually using, use the System Monitor Integration, though I can’t remember whether the RAM reported there also includes addons

1 Like

My money is on those… Frigate alone needs a lot of memory and CPU… especially if you run it without a Coral TPU.

I can increase the hardware settings in here, the issue is: it never stop growing.
I restarted the VM because the whole thing was a little unstable, but next time I’ll try to take a look on it.
Thanks!

Coral TPU is a really nice thing, but a little to much ($$$) for me at the moment, so I have to deal with it in other ways…
But thanks for the tips, I will keep close eyes on those guys! :eye_in_speech_bubble:

1 Like

Hang on, read my Edit in my first reply.

Actually… I’ll DM you. I might have an idea.

1 Like

I already did it… And the System Monitor is already monitoring the whole situation… Now, just wait a few days to check it out!

1 Like

Which pretty much all new users have to do because it is made from unobtainium.

1 Like

HA probably using that much RAM. I don’t recall the particulars, but I noticed the same thing and vaguely recall it has something to do with how Proxmox pulls the memory usage for HA.

Case in point, Proxmox is showing 7.6/8 GB memory usage for me, but HA is only showing 3.3 GB in use.


I was just thinking on something… The memory which is shown in System Monitor counts with the Addons?
As far as I know, the Addons and other custom integrations runs in a separated docker container. So the System Monitor shows the only HA usage or the whole system (including Addons and etc.)?

You must be on to something there. As a quick test, I stopped frigate and saw the memory use in both HA and Proxmox drop by 1.1 GB.

I’ll wait a few days… For now the things are quite good around here, I need to wait for the next episode.

image

Normally takes two or three days.

It is what @ShadowFist posted about caching.

I use the following markdown card to give an overview of addon resource usage. Within the code you can set it to sort by CPU or Memory usage. Light grey addon names are ones that are not running. Requires System Monitor to be loaded.

~Brian


  |  {{states('sensor.processor_temperature') }} C |
  {{states('sensor.processor_use') }}% | {{states('sensor.load_1m')}} |
  {{states('sensor.load_5m')}} | {{states('sensor.load_15m')}} |

  |

  |

  | Entities (enabled): | {{ states | count }} |

  |

  | {{' ' * 10}} | {{' ' * 10}} | {{' ' * 10}} | {{' ' *
  10}} | {{' ' * 10}} |

  {% set ns = namespace(_list=[]) %}

  {% set always_on = ['home_assistant_core', 'home_assistant_supervisor'] %}

  {% set total_mem = states('sensor.memory_use') | float(0) +
  states('sensor.memory_free') | float(0) %}

   {%- for s in states.sensor if "_cpu_percent" in s.entity_id %}
   {%- set base = s.entity_id | replace("_cpu_percent","")
    | replace("sensor.","") %}
   {% set running ='on' if base in always_on else states('binary_sensor.'~base~'_running') %}
   {% set update = (states('sensor.'~base~'_newest_version') if (states('update.'~base~'_update') == 'on' and has_value('sensor.'~base~'_version')) else ' ') | string %}
   {% set update = ' test' %}

  {# Build dynamic dict. Convert number values to float to enable sorting #}
   {%- set _dict = 
    {
       "base": base,
       "entity": s.entity_id, 
       "cpu": (s.state | float(0)),
       "memory": (states('sensor.'~base~'_memory_percent') | float(0)),
       "memory_mb": total_mem * (states('sensor.'~base~'_memory_percent') | float(0)) / 100,
       "version": states('sensor.'~base~'_version'),
       "update" : update,
       "running": running
    } %}
   {# Add dict to our list #}
   {%- set ns._list = ns._list + [_dict] %}
  {%- endfor %} 

  `

  {% set sortkey='cpu' %}


  | Addons | % CPU | % Memory | MB | Update | 

  |:----|----:|----:|----:|:----|

  {%- for s in (ns._list
      | sort(attribute=sortkey, reverse=true)
  ) %}

  {{  '<font color=LightGray>' if s.running != 'on' -}}

  {{ (" %s | %6.2f | %10.2f | %12.2f | %s " % (s.base[:40], s.cpu, s.memory,
  s.memory_mb, '')) -}}

  {{ '</font>' if s.running != 'on' -}}

  {%- endfor %}

  | {{'&nbsp;' * 50}} | {{'&nbsp;' * 20}} | {{'&nbsp;' * 25}} | {{'&nbsp;' *
  25}} | {{'&nbsp;' * 30}} |
title: Resources
2 Likes