How to flush the RAM memory cache on a Linux server??

Collapse

Unconfigured Ad Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Rachel S
    Member
    • Apr 2022
    • 98

    How to flush the RAM memory cache on a Linux server??

    Hello,

    I want to flush the RAM memory cache on my Linux server to improve the server's performance. Can someone assist me with how to flush the memory cache?
  • Rex Maughan
    Senior Member
    • Mar 2022
    • 107

    #2
    AccuWeb.Cloud

    Hello Rachel S,


    The RAM is a vital part of the server. Unfortunately, RAM memory is often blocked in the cache; therefore, the server loads slowly and does not respond to the new processes because RAM memory isn't available for the new processes.

    However, to resolve the RAM memory cache issue, you can set the Cron Jobs to reset the RAM memory cache after every 30 minutes by following the ways below,
    • Firstly, log in to the server as a root user.
    • Then, create new file /root/memory.sh in your editor and add the following to the file,
    echo 1 > /proc/sys/vm/drop_caches
    root@linux [~]# cat /root/memory.sh
    echo 1 > /proc/sys/vm/drop_caches
    • Now, Set the 755 permission to /root/memory.sh file
    • Lastly, add the Cron under the server's main crontab file by the following command,
    Code:
    */30 * * * * sh /root/memory.sh;
    Thus, by following the above methods, Cron the /root/memory.sh will run once every 30 minutes and clear the RAM memory cache.

    --------------------------------
    Regards,
    Rex Maughan

    Comment

    Working...
    X