HA running slow due to Mosquito broker

I am running supervised on Debian 11

My install has been unstable for months and I have been fighting it.
First thing I found was my disk was filling up this was causing things to not load on boot and to crash.
It took me some time to track down the culprit (it was not log files)
It was the adguard integration database. I found it by running this command to show me files ove 1Gb

sudo find / -xdev -type f -size +1G

That showed me large files, from there I tracked it down removed the integration deleted the file and all was well. (the file would grow very fast to fill all available space)

Now everything loads but is still running slow intermittently.

Top showed me that my mosquito broker was using 40% of my available memory.
I shut it down and everything was fast again, but I need it so this was not a solution.
I then increased my swap size from 1G to 2.5G, this helped a bit but not much.

After much googling I came across a post that was only peripherally related but I figured I would try the advice.

Ran the command

sudo sysctl -w vm.drop_caches=1

using the command

free

I could see my a little of my cache freed up.

hass:~$ free
                          total        used        free            shared  buff/cache   available
Mem:         3861228     3273788      208596         472      378844      393432
Swap:        2536440     1683748      852692

hass:~$ free
                         total        used             free      shared  buff/cache   available
Mem:         3861228     3266804      249892         472      344532      398500
Swap:        2536440     1683748      852692

The buff/cache would generally get over 500000

these screenshots are after my “fix” which runs through a root cron job every minute.

I am sure this is a very hacky way to mitigate the problem and I would love to get to the bottom of it. I am a good copy and paster :slight_smile: but not a programmer so I put this up for any other poor bastard like me with this sort of issue. Any suggestions on how I might properly fix this are welcome. I am considering rebuilding my whole system when I am off around Christmas just trying to decide whether to upgrade hardware.

Craig