[CentOS] Swap Considerations

Thu Mar 1 12:48:58 UTC 2007
James Olin Oden <james.oden at gmail.com>

On 3/1/07, Feizhou <feizhou at graffiti.net> wrote:
> > heh, it does appear that the conversation missed the boat.  Actually,
> > I asked RedHat (when we supposedly had their attention) years ago
> > about what the real swap requirements for linux where, or what were
> > the best practices, and what should we monitor concerning swap for
> > alarming purposes and never really got a good answer.  Those were back
> > in the RH 9 days, but at anyrate I would be interested in hearing
> > oppinions of how one should use swap if they were to use it.
> With the presence of LVM, I would make a mirror array, make that a PV
> and later make a lv for the swap partition.
> I think monitoring swap comes down to two things: strange memory use and
> whether there is a lot of stuff going in and out of swap and the amount
> of data. For I/O intensive servers, you don't want to see swap being
> used so monitoring swap usage can help to fine tune no. of processes or
> whatever to keep the box from using swap if it does use swap.
What your really saying, and this is a very fair answer, is to monitor
it on systems with different loads and learn what it should look like
when things are well, such that I can determine what is the norm, and
thus with that defination identify aberrations.

> So I personally only care about swap if using it gets in the way
> (usually servers) and if my box does not have enough RAM for the
> applications I have to open where disk I/O is not critical (usually
> desktops)
Presently most of our servers have between 4 and 8 gigs of ram, and
our distro (a one off from CentOS) blankedly creates a 2 gig swap area
on top of lvm on top of a raid 1 md device.  But with all the
applications we write not a one of them do we ever want to actually
use swap, we mainly have it there just in case.  What we never did was
the research on our own to figure out what real threshholds exist such
that we could monitor and alarm when thresholds were crossed.  On
Solaris we were given very specific things to look for by Sun, so we
were taken aback when RedHat (whom we were paying too) did not give
such specific instructions.