当前位置: 首页 > Linux > 正文

How to Flush Memory Cache, Buffer Cache on Linux Server

Many times systems faced low memory issues of Linux systems running a while. The reason is that Linux uses so much memory for disk cache is because the RAM is wasted if it isn’t used. Cache is used to keep data to use frequently by the operating system. Reading data from cache if 1000’s time faster than reading data from hard drive.
It’s good for the os to get data from the cache in memory. But if any data not found in the cache, it reads from hard disk. So it’s no problem to flush cache memory. This article has details about how to Flush Memory Cache on Linux Server.

Clear Linux Memory Buffer Cache

There are three options available to flush cache of Linux memory. Use one of below as per your requirements.

  • Free pagecache, dentries and inodes in cache memory
  • Free dentries and inodes use following command
  • Free pagecache only use following command

Schedule Cron to Flush Cache Regularly

It’s a good idea to schedule following in crontab to automatically flush cache on the regular interval. Use ‘crontab -e’ command to edit cron on your system.

The above cron will execute on every hour and flushes the memory cache on your system.

Find Cache Memory uses in Linux

Use free command to find out cache memory uses by Linux system. Output of free command is like below

Sample Output

Last column is showing cached memory ( 14953 MB) by system. -m option is used for showing memory details in MB’s.

How to Flush Memory Cache and Buffer Cache on Linux Server

本文固定链接: http://t.yjsec.com/index.php/2017/12/02/7/ | 下一站

该日志由 admin 于2017年12月02日发表在 Linux 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: How to Flush Memory Cache, Buffer Cache on Linux Server | 下一站
关键字:

How to Flush Memory Cache, Buffer Cache on Linux Server:等您坐沙发呢!

发表评论

快捷键:Ctrl+Enter