12 March 2011

Overcoming a Full Linux Memory

Occasionally, the computer / server we have full memory (RAM) when running multiple processes simultaneously. Memory is full this will cause the performance of your computer / linux server becomes slow or even stop at a certain limit (hank)

To overcome it, we can tell the kernel to clean the cache, dentries and inodes from memory. The trick ...?

*. To clean pagecache
# Echo 1 > /proc/sys/vm/drop_caches

*. To clean inodes and dentries
# Echo 2 > /proc/sys/vm/drop_caches

*. To clean all three (pagecache, inodes and dentries)
# Echo 3 > /proc/sys/vm/drop_caches

To do this periodically, please cron one of the above command (echo 3 I use to clean all three):
# Crontab-e
* * / 2 * * * echo 3> / proc / sys / vm / drop_caches

The above example will clear pagecache, inodes and dentries in memory every 2 hours

HTH
;-)

No comments:

Post a Comment