Monday, July 3, 2017

Flush or Clear ram memory or buffer memory in linux Centos

Sometimes the use of applications on the linux server is very high, either because of high server load or anything else caused by the application. 
But to be able to restart the operating system is not possible or many things to consider such as downtime or coordination with other parties.

Here's how to make the linux server memory free again:


1. Clear PageCache only
#
sync; echo 1 > /proc/sys/vm/drop_caches

Clear dentries and inodes.
#
sync; echo 2 > /proc/sys/vm/drop_caches

3. Clear PageCache, dentries and inodes.
#
sync; echo 3 > /proc/sys/vm/drop_caches

Tested on CentOS release 6.7

References: 

https://tecadmin.net/flush-memory-cache-on-linux-server/
https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/ 

https://unix.stackexchange.com/questions/87908/how-do-you-empty-the-buffers-and-cache-on-a-linux-system

No comments:

Post a Comment