Re: Swappiness setting on a linux pg server - Mailing list pgsql-performance

From Kevin
Subject Re: Swappiness setting on a linux pg server
Date
Msg-id 49298.209.244.4.106.1161290341.squirrel@www.drule.org
Whole thread Raw
In response to Swappiness setting on a linux pg server  (Tobias Brox <tobias@nordicbet.com>)
List pgsql-performance
> I just came to think about /proc/sys/swappiness ...
>
> When this one is set to a high number (say, 100 - which is maximum), the
> kernel will aggressively swap out all memory that is not beeing
> accessed, to allow more memory for caches.  For a postgres server, OS
> caches are good, because postgres relies on the OS to cache indices,
> etc.  At the other hand, for any production server it's very bad to
> experience bursts of iowait when/if the swapped out memory becomes
> needed - particularly if the server is used for interactive queries,
> like serving a web application.

This is very useful on smaller systems where memory is a scarce commodity.
 I have a Xen virtual server with 128MB ram.  I noticed a big improvement
in query performance when I upped swappiness to 80.  It gave just enough
more memory to fs buffers so my common queries ran in memory.

Yes, throwing more ram at it is usually the better solution, but it's nice
linux gives you that knob to turn when adding ram isn't an option, at
least for me.


--
Kevin


pgsql-performance by date:

Previous
From: Tobias Brox
Date:
Subject: Re: Swappiness setting on a linux pg server
Next
From: Ben Suffolk
Date:
Subject: New hardware thoughts