Simon Bryan wrote:
Hi all,
Below is part of the 'top' display from one of my servers. Note that it is sorted on
Memory and that the top few use only 1.1% of memory, yet the summary at the top
would indicate that about 90% or more of memory was in use.

Can anyone give me some possible reasons / fixes for this or am I just reading it
wrong?


7:47am up 22 days, 18:29, 1 user, load average: 0.12, 0.07, 0.01 139 processes: 138 sleeping, 1 running, 0 zombie, 0 stopped CPU states: 0.7% user, 0.3% system, 0.0% nice, 98.8% idle Mem: 771132K av, 760852K used, 10280K free, 5740K shrd, 222472K buff Swap: 522072K av, 5992K used, 516080K free 166472K cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME COMMAND
29455 nlazo      9   0  8868 8868  1036 S     0.0  1.1   0:00 aucemail
 1004 mysql      9   0  8164 8164  2312 S     0.0  1.0   0:27 mysqld
 1018 mysql      8   0  8164 8164  2312 S     0.0  1.0   0:21 mysqld
 1019 mysql      9   0  8164 8164  2312 S     0.0  1.0   2:38 mysqld
 1020 mysql      9   0  8164 8164  2312 S     0.0  1.0   0:00 mysqld
27344 apache     9   0  7488 7488  7000 S     0.0  0.9   0:00 httpd
27345 apache     9   0  7488 7488  7000 S     0.0  0.9   0:00 httpd
27338 apache     9   0  7384 7384  7000 S     0.0  0.9   0:00 httpd
27341 apache     8   0  7384 7384  7000 S     0.0  0.9   0:00 httpd
27343 apache     8   0  7384 7384  7000 S     0.0  0.9   0:00 httpd
27337 apache     9   0  7380 7380  7032 S     0.0  0.9   0:00 httpd
27342 apache     9   0  7380 7380  7000 S     0.0  0.9   0:00 httpd
27346 apache     9   0  7380 7380  7000 S     0.0  0.9   0:00 httpd
28333 apache     9   0  7380 7380  7028 S     0.0  0.9   0:00 httpd

This looks pretty normal. Notice the "buff" and "cache" are about 217Mb and 163Mb respectively? The Linux kernel will try and use all the RAM is can for buffers and cache, after accomodating the programs etc, to minimise disk/network access (which is much slower than RAM - naturally). However, if a program needed more space (heap/stack etc) the kernel will sacrifice buff and/or cache to make room.


The only time to worry is when you see a lot of swap in use and large amount of paging activity. This is usually a good sign that either something has sprung a leak, or that you need more RAM. However, if a program starts then goes idle for an extended period, the kernel may well swap it out of RAM to either make space for another program or allocate more buffers/cache. I'm not that familiar with the actual complexities of the kernel's memory allocation algorithms but you get the general idea.

HTH.

Cheers,

James

--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to