Clear Linux 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
# sync; echo 3 > /proc/sys/vm/drop_caches
-
Free dentries and inodes use following command
# sync; echo 2 > /proc/sys/vm/drop_caches
-
Free pagecache only use following command
# sync; echo 1 > /proc/sys/vm/drop_caches
Schedule Cron to Flush Cache Regularly
Its a good idea to schedule following in crontab to automatically flush cache on regular interval.# crontab -l 0 * * * * sync; echo 3 > /proc/sys/vm/drop_cachesThe above cron will execute on every hour and flushes the cached memory on 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# free -m
Sample Output
total used free shared buffers cached Mem: 992 406 586 0 155 134 -/+ buffers/cache: 116 876 Swap: 2015 0 2015Last column is showing cached memory ( 134 MB) by system. -m option is used for showing memory details in MB’s.
Source URL: http://tecadmin.net/flush-memory-cache-on-linux-server/
0 comments:
Post a Comment