Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id C83E29FB222 for ; Thu, 19 Oct 2006 10:56:53 -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 47210-03 for ; Thu, 19 Oct 2006 13:55:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from lynet.oppetid.no (oppetid.no [80.65.51.2]) by postgresql.org (Postfix) with ESMTP id E42F69FB258 for ; Thu, 19 Oct 2006 10:54:34 -0300 (ADT) Received: by lynet.oppetid.no (Postfix, from userid 1019) id 1E83111A200; Thu, 19 Oct 2006 15:54:28 +0200 (CEST) Date: Thu, 19 Oct 2006 15:54:28 +0200 From: Tobias Brox To: pgsql-performance@postgresql.org Subject: Swappiness setting on a linux pg server Message-ID: <20061019135428.GD20328@oppetid.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Organization: Group Nordicbet User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200610/399 X-Sequence-Number: 21528 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 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.