Saturday, June 22, 2013

Running out of memory on your linux machine ?!!

Take the following stat.. where we see that only 260MB is shown free and can see also that around 29GB was cached (cached by the *NIX OSes incase that it may require in near future) and it appears that 31GB was in completely used and only 260MB seems to be free.

[root@web3 ~]# free -m

             total used free shared buffers cached

Mem:         32062 31801 260      0     486  29615

-/+ buffers/cache: 1699 30363

Swap:        4095  0    4095


But for Kernel saw it as around 30GB was in free in buffers/cache, So the kernel would decide whether if it required to flush currently inactive data off the RAM when it's required by a new process depending on the memory available.

The attempt made to keep the server still running by forcefully flushing the inactive entries off the RAM .
And also the server was accessible at that time and responding.
[root@web3 ~]# echo 3 > /proc/sys/vm/drop_caches; sync 
As this is a non-destructive operation, and the option 3 will only free things that are completely unused like pagecache, dentries and inodes.

After this... Here's what the current memory utilization on the server is:


[wiz@web3 ~]$ free -m


            total       used       free     shared    buffers     cached

Mem:         32062        872      31189          0        133         55

-/+ buffers/cache:        684      31377

Swap:         4095          0       4095

[wiz@web3 ~]$ uptime

06:30:14 up 21 days,  6:42,  2 users,  load average: 0.00, 0.01, 0.00
HTH

Learn and Share The Knowledge


No comments:

Post a Comment