Re: Swappiness setting on a linux pg server

From: "Kevin" <kev(at)drule(dot)org>
To: "Tobias Brox" <tobias(at)nordicbet(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Swappiness setting on a linux pg server
Date: 2006-10-19 20:39:01
Message-ID: 49298.209.244.4.106.1161290341.squirrel@www.drule.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Mike 2006-10-20 01:24:15 Vacuum and Memory Loss
Previous Message Tobias Brox 2006-10-19 19:57:14 Re: Swappiness setting on a linux pg server