linux is in swap --- yes or no?

Toby Corkindale tjc at wintrmute.net
Tue May 15 10:04:46 BST 2007


nigel at turbo10.com wrote:
> 
> HI Adam,
>>
>> You can get to pswpin and pswpout using that module and, by monitoring
>> these values, you can work out how much swapping is taking place.
>>
> 
>     Thanks. Hmmm. I can see it's a bit tricky. There's a web page that
> shows an indicator light - ideally I want it to turn red if the
> application is starting to consume swap. But the indicator light takes
> an instaneous look at the state of swap - so it looks like I need to
> observe over a longer period.

Are you sure that "consuming swap" is an indication of a problem? Linux
will let applications share (read-only) memory of things like shared
libraries and so on automatically, which saves memory. However often a
number of these libraries are then unused and committed to swap - thus
almost every application you run will show up as having some part of its
VM in swap.

A better test might be to count the number of page faults occurring over
a period of time to your process. Page faults occur to a degree
normally, but massive numbers of them can indicate lots of swapping is
going on. It can also indicate other issues, but generally if you're
getting a lot more than usual then it's a problem of some sort!

Toby



More information about the london.pm mailing list