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!

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?

The router doesn't restart AGH when the RAM use is high. It doesn't have to.

RAM is managed separately and effectively from each script/process running on the router.

My point is that unless this is solving an actual issue, it is not needed (no matter how elegantly it has been implemented).
 
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.
To clarify, there is no issue i'm trying to solve. Using swap is perfectly fine.

In my original e-mail, i've mentioned "mitigation" rather than fix because my objective was to optimize the router performance, run daemon/processes as much as possible in RAM and minimal usage of swap.

AGH when running in merlin+asus router constrained in 1GB of ram will not touch swap, that's a given.

However, when running updates on large blocklists, RAM total usage goes to 980MB and uses additional swap which translates to additional 300MB+ RAM which is not released by AGH/GO to Linux.

This 300MB+ hogging of precious RAM as cache/buffer all the time just for the "blocklist updates" could be removed, released to Linux and can be of better use by the router to do it's multitude of duties like chrony/ntp, AIProtection, etc. thus the script i've shared if it helps someone.

There is a current issue opened with AGH since last year for this: High RAM consumption during filter updates #5606 as mentioned by other members here.
 
No, that isn't a current issue for a properly configured setup (and one that acknowledges the limitations (RAM) of the specific router it is used on).

If the router needed that RAM back to do current work, it would free it. That's the point. ;)

I would not be running that script at all. But, that's just me. :)
 
There is a current issue opened with AGH since last year for this: High RAM consumption during filter updates #5606 as mentioned by other members here.
Good luck with that one, I have been fighting this "memory" fight with AdGuardHome for a while. The simple fact is, it is not designed, nor is it optimized with the memory sizes of our routers taken into consideration. This is solely a design limitation. In order to "truely" run Adguardhome comfortably on our routers, they would need a minimum of 2gb of ram. Other wise, you have to go bare minimum in the "other scripts and processes" department. Also, you may want to still consider a reasonable size swap. I don't see nothing wrong with a swap being "reasonably" used if it does not lead to the router crashing. That is its true purpose. AdGuardHome developers are trying to reduce this memory issue by changing the way it downloads the list. Instead of doing it in "parallel", they are looking at doing lists sequentially. This means one list has to complete, before for the other one downloads. This "may" reduce the amount of memory AdGuardHome takes hold of at the expense of having to wait for each list to individually download. @balr0g Another thing Adguardhome developers have done is made it to where you can specify "localized" lists instead of the generic ones they provide. What this means is you would be responsible for downloading the lists and maintaining them locally separate from adguardhome. This will reduce the "memory" strain because AdGuardHome will not do the list fetching itself.
 
Last edited:
No, that isn't a current issue for a properly configured setup (and one that acknowledges the limitations (RAM) of the specific router it is used on).

If the router needed that RAM back to do current work, it would free it. That's the point. ;)

I would not be running that script at all. But, that's just me. :)
Linux on Asus and AGH running is fine. "AGH with updates" component is not...

Here is some proof screenshots below of potential performance impacts of AGH updates taking up 30%+ of precious memory of 1GB low memory device like the GT-AX6000. Would rather restart AGH and go to a state like the "Before Screenshot" for peak performance.

Before Screenshot. AGH running typically running or after AGH restart. Notice no swap and the memory usage "Mem" where green is used, pink is shared, blue is buffer and yellow has a sizeable cache.
2024-02-25 17_16_29-1 after htop.png

After Screenshot. AGH updates triggered, swap used. used memory is 950MB+, shared/buffer/cache is zero, running processes memory usage is sent to swap file like nt_center,netool, ledbtn, haveged, etc.
2024-02-25 17_45_14-amd dvr overlay before htop.png
 
Those graphs don't show any performance differences.

Theoretical doesn't translate to real life very well.
 
Here is some proof screenshots below

Not really needed. I don't use AGH on router, but when testing it was clear enough - it has blocklists limitations in order to work properly on limited router hardware. You have to reduce your blocklists or move AGH to dedicated hardware - this is the only fix. No script will create extra RAM on your router. Your swap is mostly useless.
 
Those graphs don't show any performance differences.

Theoretical doesn't translate to real life very well.
kk... i'll take your word for it. Thanks.

Not really needed. I don't use AGH on router, but when testing it was clear enough - it has blocklists limitations in order to work properly on limited router hardware. You have to reduce your blocklists or move AGH to dedicated hardware - this is the only fix. No script will create extra RAM on your router. Your swap is mostly useless.
Yes... Testing AGH for a couple of days with blocklist rules of 150k+ instead of 400k+. And using upstream DNS pointing to free controld/nextdns with hagezi pro, it's working surprisingly well.

Good luck with that one, I have been fighting this "memory" fight with AdGuardHome for a while. The simple fact is, it is not designed, nor is it optimized with the memory sizes of our routers taken into consideration. This is solely a design limitation. In order to "truely" run Adguardhome comfortably on our routers, they would need a minimum of 2gb of ram. Other wise, you have to go bare minimum in the "other scripts and processes" department. Also, you may want to still consider a reasonable size swap. I don't see nothing wrong with a swap being "reasonably" used if it does not lead to the router crashing. That is its true purpose. AdGuardHome developers are trying to reduce this memory issue by changing the way it downloads the list. Instead of doing it in "parallel", they are looking at doing lists sequentially. This means one list has to complete, before for the other one downloads. This "may" reduce the amount of memory AdGuardHome takes hold of at the expense of having to wait for each list to individually download. @balr0g Another thing Adguardhome developers have done is made it to where you can specify "localized" lists instead of the generic ones they provide. What this means is you would be responsible for downloading the lists and maintaining them locally separate from adguardhome. This will reduce the "memory" strain because AdGuardHome will not do the list fetching itself.
I hear you. researching further, i came across a shell script Adblock Lean from openwrt which uses dnsmasq 2.86 and newer to adblock and they face the same issue with updating large blocklist for low memory routers. Now going to the route as what @Tech9 mentioned. Thanks to all for the open discussion!
 

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