1. Post filters have been ramped up due to high spam activity. If your post is marked for moderation, be patient. A moderator will review and release it as soon as possible.
    Dismiss Notice
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 New Around Here

    Joined:
    Oct 14, 2017
    Messages:
    8
    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. appleseed

    appleseed Occasional Visitor

    Joined:
    Jun 26, 2010
    Messages:
    28
    Location:
    everywhere
    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.
     
    Ryan_C likes this.
  3. john9527

    john9527 Part of the Furniture

    Joined:
    Mar 28, 2014
    Messages:
    4,889
    Location:
    United States
    +1

    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.
  4. Ryan_C

    Ryan_C New Around Here

    Joined:
    Oct 14, 2017
    Messages:
    8
    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
  5. ColinTaylor

    ColinTaylor Part of the Furniture

    Joined:
    Mar 31, 2014
    Messages:
    4,239
    Location:
    UK
    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

Share This Page