Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id D60849FA332 for ; Thu, 19 Oct 2006 12:29:08 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 11664-03 for ; Thu, 19 Oct 2006 15:28:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id D59E99FA002 for ; Thu, 19 Oct 2006 12:28:33 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id E71D756435; Thu, 19 Oct 2006 10:28:32 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Thu, 19 Oct 2006 10:28:31 -0500 Date: Thu, 19 Oct 2006 10:28:31 -0500 From: "Jim C. Nasby" To: Tobias Brox Cc: pgsql-performance@postgresql.org Subject: Re: Swappiness setting on a linux pg server Message-ID: <20061019152831.GT71084@nasby.net> References: <20061019135428.GD20328@oppetid.no> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20061019135428.GD20328@oppetid.no> X-Operating-System: FreeBSD 6.1-RELEASE-p10 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.13 (2006-08-11) X-Hashcash: 1:20:061019:tobias@nordicbet.com::kjmnbGyHdWl+Bb1V:00000000000000000 0000000000000000000000001uZm X-Hashcash: 1:20:061019:pgsql-performance@postgresql.org::PXJ1OPZbIJcD1s12:00000 0000000000000000000000000STK X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200610/403 X-Sequence-Number: 21532 On Thu, Oct 19, 2006 at 03:54:28PM +0200, Tobias Brox wrote: > 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. > > I know there are much religion on this topic in general, I'm just > curious if anyone has done any serious thoughts or (even better!) > experimenting with the swappiness setting on a loaded postgres server. I think it'd be much better to experiment with using much larger shared_buffers settings. The conventional wisdom there is from 7.x days when you really didn't want a large buffer, but that doesn't really apply with the new buffer management we got in 8.0. I know of one site that doubled their performance by setting shared_buffers to 50% of memory. Something else to consider is that many people will put pg_xlog on the same drives as the OS (and swap). It's pretty important that those drives not have much activity other than pg_xlog, so any swap activity would have an even larger than normal impact on performance. > I would assume that the default setting (60) is pretty OK and sane, and > that modifying the setting would have insignificant effect. My > religious belief is that, however insignificant, a higher setting would > have been better :-) > > We're running linux kernel 2.6.17.7 (debian) on the postgres server, and > our memory stats looks like this: > total used free shared buffers cached > Mem: 6083M 5846M 236M 0 31M 5448M > -/+ buffers/cache: 366M 5716M > Swap: 2643M 2M 2640M > > In addition to the postgres server we're running some few cronscripts > and misc on it - nothing significant though. -- Jim Nasby jim@nasby.net EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)