[lug] Swap utilization

Jeff Schroeder jeff at neobox.net
Fri Jun 11 14:52:56 MDT 2004


I know there's a constant whirlwind of confusion about swapping in 
Linux, and I've read many of the articles circulating.  Now I'm paying 
more attention to how my servers use swap, and noticed that one (which 
is always heavily loaded) seems to be swapping in a strange way.

Checking the memory breakdown yields something like this:

# cat /proc/meminfo 
MemTotal:       482672 kB
MemFree:         44744 kB
Buffers:         67340 kB
Cached:          52836 kB
SwapCached:      59124 kB
Active:         199096 kB
Inactive:        34868 kB

This is a 512MB machine; notice that almost all of the memory is being 
used.  I've got 44MB free, which is all well and good, but there's 59MB 
of swap being used.  The situation is fairly consistent: 50-60MB of 
swap used at any given time, with 40-50MB of free memory sitting out 
there.

I wonder:

1) Why isn't some of that swapped memory getting pulled back into RAM?  
Wouldn't it be better (where "better" is subjective) to drop the free 
memory to, say, 10MB if I can drop swap too?

2) Would adjusting /proc/sys/vm/swappiness (which is set to the default 
60) be wise?  I know swap can be very handy during periods of high 
load, so obviously I don't want to turn it off completely.

3) Is it even worth worrying about?  The server's performance is good-- 
it's responsive and able to handle everything I throw at it.  The load 
average is down around 0.20, which indicates nothing is really taxing 
the CPU.

Sometimes it's better to leave well enough alone, but I'm a little 
confused about the situation and would love to squeeze out a little 
more performance if I can. :)

TIA,
Jeff



More information about the LUG mailing list