1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

Regularly flush caches. What is this? On or Off?

Discussion in 'Asuswrt-Merlin' started by Ryan_C, Dec 13, 2017.

  1. Ryan_C

    Ryan_C Occasional Visitor

    Oct 14, 2017
    Hi all,

    I apologize if this has been discussed here before. I couldn't find much information about this anywhere. I only remember I have read someone (couldn't find that thread now) said disable this function would increase performance, which agrees to the explanation in the firmware. But I was confused. What's point of having more free RAM if it's not for performance? Can someone explain what this function really achieve? Should I keep it on of off?

    My router is a TM-AC1900 running Merlin 380.69_Beta 1. Thank you!
  2. Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!
  3. appleseed

    appleseed Regular Contributor

    Jun 26, 2010
    The router stores connection information in cache (RAM) for quick retrieval. It's faster and means RAM cache usage will grow/shrink automatically for Linux and nothing to worry about.

    Some time back in the day around Merlin v378.56 some people complained (alot of people actually) that a minor change Merlin made to prefer caching instead of flushing caused the amount of RAM in use to grow - some people were upset about it - when in fact it's harmless and just Linux doing what it should be doing.

    You can enable/disable this behavior when you select 'regularly flush cache'. The amount of RAM in use will be lower after flushing, with a slight penalty in milliseconds for every new connection not found in cache due to flushing.

    In my opinion you should prefer to let the kernel manage cache, and do not flush, for optimum performance.
    Quoc Huynh and Ryan_C like this.
  4. john9527

    john9527 Part of the Furniture

    Mar 28, 2014
    United States

    It can also have some visible side effects if you enable the flush.....such as attached USB disks that have spun down now spinning up just by accessing the router gui...
    Ryan_C likes this.
  5. Ryan_C

    Ryan_C Occasional Visitor

    Oct 14, 2017
    Thanks a lot! Great insight there!!

    A couple follow up questions -
    1) Does that mean the performance penalty of flushing is only related to new connections (like quicker to recognize and connect clients?)?
    2) After disabling the flush, my RAM usage could get up to 80%+ while doing some FTP file transferring and that % stays there even when the transfer was complete. I was wondering if there gonna be any problem with the high RAM usage. So I intentionally "stress tested" it by connecting all my clients and streaming 4K video on several devices, and transferring large files at same time. No matter what I did, I couldn't get the RAM usage to go over 90%, even though CPU is close to 100% in this case. My question is how possible to ran the RAM to 100% on this router? And what could go wrong if that happens??

    Thanks again!
    Last edited: Dec 13, 2017
  6. ColinTaylor

    ColinTaylor Part of the Furniture

    Mar 31, 2014
    I would agree with @appleseed 's conclusion although I think he is in error when he says "Regularly flush caches" relates to connection information. The amount of memory used by connection tracking is fairly trivial anyway.

    As far as I can see from the source code this option is calling the free_caches() function which in turn is using the kernel drop_caches. This functions frees up memory used by the pagecache and/or dentries and inodes. So this is predominately about freeing memory used when reading and writing to filesystems. This would be things like disk scans, Samba/FTP shares or the media server.

    It's interesting to note that the kernel.org entry says:
    Obviously that statement must be read in the context that we are talking about a router with limited RAM and not a server.

    So in answer to @Ryan_C 's question 1), I don't believe this setting has any bearing on the speed of network connections.
    Last edited: Dec 14, 2017
Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!