On Thu, 2007-03-01 at 23:17 +0800, Feizhou wrote:
It comes down to whether the use of swap has a significant effect on your operations. You can tell the kernel to not ever use swap unless absolutely necessary: swappiness = 0. Normally it is set at 60 (range is from 0 - 100). Let me explain how I would handle swap.
Take a case of mail servers with hundreds of processes that only have 1GB of RAM and a pair of disks. I would use vmstat to check the 'si so' columns to see whether the box is swapping. Positive figures in both columns indicates use of swap and if I see constant reports of positive figures for these two columns, I start reducing the number of processes allowed to run to increase performance. This is how I identify active swap usage as opposed to swap in use. Swap in use is not the same as active swap usage. I could get maybe tens or even hundreds of megabytes being reported in swap but if vmstat 'si so' columns report zeros, I don't worry about its effect on disk i/o because there is none. However, if the amount of swap in use continues to grow over time, I start looking for memory leaks.
This has been a very interesting thread, and given the length (discounting a few digressions), and the general number of occurrences of the subject of swap in the list archives, there is a high level of interest in the topic. My search of the Wiki turns up nothing helpful. Sounds like a good candidate for an entry on the Wiki FAQ page:
Anyone (like Feizhou :-) who has a through grasp of the topic willing to step up?
Cheers, Phil