What's new

AdGuardHome Adguard Home uses 97% of RAM

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

AGH has a memory leak problem with blocklist update. Whenever list(s) update happens memory usage skyrockets and stays high until a reboot or a restart of AGH service, it's so annoying. I had to increase filter update interval just to avoid this.
 
AGH has a memory leak problem with blocklist update. Whenever list(s) update happens memory usage skyrockets and stays high until a reboot or a restart of AGH service, it's so annoying. I had to increase filter update interval just to avoid this.
It has been shown that loading 50 or 60 filter lists on a low memory router or appliance is not indicative of a memory leak on adguardhomes part but a lack of memory present in the device. Doing such is enough to bring any low RAM appliance or router to its metaphorical knees. The same would happen with dnsmasq, dnscrypt-proxy, or Unbound on a low memory system. The problem with AdGuardHome is that is designed for multiple platforms, but is not usable across all platforms equally without taking in consideration of the amount of RAM on the physical device it is being ran on. Sure I can load AdGuardHome up on a x86_64 platform with 10gb of ram no problem.The memory constraint is negligible at that point; However, when running Adguardhome on small memory appliance/routers, special considerations need to be taken when choosing filters and blocklists. Otherwise, updating the list may grab more memory than the router has available. Then we switch to swapping, and adguardhome holds onto a greater amount of VSZ memory in anticipation of the next time it may need it for another list upgrade. The makers of AdGuardHome should have more documentation in regards to these nuances, so users don't feel like they are chasing down a memory leak when in fact they are just seeing the impacts of using AdGuardHome with limited RAM availability.
 
Last edited:
Sure I can load AdGuardHome up on a x86_64 platform with 10gb of ram no problem.

Radeon Graphics accelerated. :)

1683420473333.png


1683420708058.png


No memory leaks.
 
It has been shown that loading 50 or 60 filter lists on a low memory router or appliance is not indicative of a memory leak on adguardhomes part but a lack of memory present in the device. Doing such is enough to bring any low RAM appliance or router to its metaphorical knees. The same would happen with dnsmasq, dnscrypt-proxy, or Unbound on a low memory system. The problem with AdGuardHome is that is designed for multiple platforms, but is not usable across all platforms equally without taking in consideration of the amount of RAM on the physical device it is being ran on. Sure I can load AdGuardHome up on a x86_64 platform with 10gb of ram no problem.The memory constraint is negligible at that point; However, when running Adguardhome on small memory appliance/routers, special considerations need to be taken when choosing filters and blocklists. Otherwise, updating the list may grab more memory than the router has available. Then we switch to swapping, and adguardhome holds onto a greater amount of VSZ memory in anticipation of the next time it may need it for another list upgrade. The makers of AdGuardHome should have more documentation in regards to these nuances, so users don't feel like they are chasing down a memory leak when in fact they are just seeing the impacts of using AdGuardHome with limited RAM availability.
I posted here as an FYI, they know the problem, sorry I forgot to add the link:
 
See, you have the flexibility to use these filters with no tight memory constraints. No Problems here.

Yes, confirming your post above. AdGuard Home uses about 340MB RAM in this configuration. As I always say whatever is installed extra has to fit the limited router hardware. The same configuration on AX86U stops the UI refresh. This is about 1.4mil rules, with 3mil the router goes into coma state.
 
I posted here as an FYI, they know the problem, sorry I forgot to add the link:
That's awesome I linked a study I participated in https://github.com/AdguardTeam/AdGuardHome/issues/4437 to your issue tracker. The same "issue", but different people trying to draw the same conclusions.
 
I posted here as an FYI, they know the problem, sorry I forgot to add the link:
I saw this thread and did as advised. However I got very inconsistent results. Sometimes I saw ~300MB free men post startup, other times ~70MB

Now I’m basically forced to schedule reboots (twice a wk) to prevent router freezes from happening. This is on top of env vars + swappiness config

Edit 6/21/23: been on Edge build and same config as above, have been encountering fewer issues. On most occasions swap doesn't get activated. Sometimes AGHs webui may throw a fit but the router remains perfectly functional. And I'd switched to larger Blocklists (hegazi ultimate + TIF). Still doing 2 reboots a week but will keep monitoring and if things go fine will reduce that number to 1.
 
Last edited:
I saw this thread and did as advised. However I got very inconsistent results. Sometimes I saw ~300MB free men post startup, other times ~70MB.

Now I’m basically forced to schedule reboots (twice a wk) to prevent router freezes from happening. This is on top of env vars + swappiness config
How big is your blocklist or filter size because this greatly impacts how much memory guzzling adguardhome requires.
 
Now I’m basically forced to schedule reboots (twice a wk) to prevent router freezes from happening.

I did a test run with AGH on AX86U with about 10 lists from the default options in adblocking and security categories and the free RAM was >300MB for a week. If you push extra installed software to the point you need a swap - your router is dead. The swap on USB is mostly useless. You have to understand your router is a RPi with very limited RAM. The RPi4 with Pi-hole example above perhaps has 2GB RAM. Your router has 1GB RAM.
 
I did a test run with AGH on AX86U with about 10 lists from the default options in adblocking and security categories and the free RAM was >300MB for a week. If you push extra installed software to the point you need a swap - your router is dead. The swap on USB is mostly useless. You have to understand your router is a RPi with very limited RAM. The RPi4 with Pi-hole example above perhaps has 4GB RAM. Your router has 1GB RAM.
and sometimes not even a full 1GB after all is said and done. Ideally, adguardhome runs best on a device with a minimum of 2gb of RAM. Here is what openwrt says about adguardhome

1683466538751.png



Some factors to consider when running AdGuardHome on the router.

  • You need to be concerned with the size of your filter list (blocklist).
  • You need to be concerned with your cache size (yes adguardhome generously uses a larger than necessary cache).
  • You need to be concerned with how much memory your router has (after all other scripts are run, but before adguardhome is ran).
  • You should have a swap to prevent the risk of OOM situation.
 
Last edited:
The router is a device with what Asus decided is enough to run Asuswrt on it. I have one GL-MT2500A device running OpenWrt and AGH pre-installed. It has 1GB RAM, but no TrendMicro and Ookla bloatware. I had no time to play with it for long, but quick runs show AGH runs better on it.
 
The router is a device with what Asus decided is enough to run Asuswrt on it. I have one GL-MT2500A device running OpenWrt and AGH pre-installed. It has 1GB RAM, but no TrendMicro and Ookla bloatware. I had no time to play with it for long, but quick runs show AGH runs better on it.
I am sure part of the "runs better" does come from better memory utilization support of the OS as well. Along with low memory foot print.

I run adguardhome on a router running openwrt that has 10gb of ram. I have never seen adguardhome push past 2gb. And that was me pushing it to the max.
 
Runs better with quick test is exactly less memory used and more responsive UI. I guess nothing can beat our x86 installations, but GL-MT2500 gadget was under $100 and has very user friendly UI. It's cheaper than RPi4 kit and comes with pre-installed and configured OS and AGH already.
 
Sorry to resurrect an old thread, but the messages/information helped me reduce memory usage on my Adguard Home install plus large blocklists.

To mitigate large memory usage:
* set "Filter Update Interval" to 24 hours (Default: 3Days). Frequent updates, less usage memory.
* Quick script below that runs every day @6am and if memory is 900MB or higher, then restart Adguard Home and clear swap.
Bash:
#!/bin/sh
# Changeme # Start #
MemoryThreshold=900000                              ; # set 900MB threshold
SwapPath=/tmp/mnt/180GB/myswap.swp                  ; # path of swap file
AGHRestart="/opt/etc/init.d/S99AdGuardHome restart" ; # full path of Adguard Home to restart
# Changeme # End   #

export PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin     ; # making sure PATH works
MemoryFree=$(free | awk 'NR==2{print $3}')          ; # get live memory

# Check if free memory is less than the threshold
if [[ "$MemoryFree" -lt "$MemoryThreshold" ]]; then
  : ; # Threshold is okay. No action needed.
else
  $AGHRestart && sleep 60        ; # restart Adguard Home and sleep for a minute
  swapoff -a && swapon $SwapPath ; # disable/enable swap
fi
 
Welcome to the forums @balr0g.

There is no need to do this at all. The router (Linux) does this as it sees fit.

Were you having other issues that this solved? Unused RAM is wasted RAM.
 
Welcome to the forums @balr0g.

There is no need to do this at all. The router (Linux) does this as it sees fit.

Were you having other issues that this solved? Unused RAM is wasted RAM.

It seems the script only restarts the AGH vs restarting the whole router! I don't think the router automatically restarts AGH when the RAM is high....maybe the whole router restarts but the script would be more convenient correct?
 
Welcome to the forums @balr0g.

There is no need to do this at all. The router (Linux) does this as it sees fit.

Were you having other issues that this solved? Unused RAM is wasted RAM.
Thanks for the welcome @L&LD ! As a former Solaris/Linux Sysadmin, In general, that is correct. Adguard Home (AGH) running is roughly using 300MB RAM with huge 400K+ rules on my blocklists.

Noticed that updating huge blocklists like oisd or steven blacks, total ram usage goes to 900MB+ and touches swap. Linux doesn't release the memory, and the next update blocklist will just increase the swap even more. Personally, i'm okay with restarting AGH to release memory so my GT-AX6000 can run it's router duties without using swap as possible and to potentially extend the life of my SSD where swap is located.

@Kingp1n:
It seems the script only restarts the AGH vs restarting the whole router! I don't think the router automatically restarts AGH when the RAM is high....maybe the whole router restarts but the script would be more convenient correct?
To be clear, No restart of router... the script runs everyday @6am via cru If memory used is 900MB+, restart only AGH and disable/enable swap to clear it. It doesn't do anything if it's less than 900MB total memory. Note, my GT-AX6000 has 1GB of RAM. You probably need to change the script upper limit to 400MB if your router has 512MB of RAM.
 
Last edited:
No need to worry about the SSD lifespan (assuming it is of decent quality, of course).

No need to worry about swap file usage. Let it use what it needs.

If Linux isn't releasing the memory, then it doesn't need to.

I don't see where this is solving an actual issue. Theoretical/Pre-emptive strikes may be fun to implement, but they're usually just a placebo.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top