Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 6893D9FA12F for ; Thu, 19 Oct 2006 17:57:41 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 74251-02 for ; Thu, 19 Oct 2006 17:57:36 -0300 (ADT) X-Greylist: delayed 00:18:28.300364 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id A09DD9FB2DD for ; Thu, 19 Oct 2006 17:57:35 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from drule.org (mainhost.drule.org [207.210.242.105]) by svr4.postgresql.org (Postfix) with ESMTP id 540F25AF8A6 for ; Thu, 19 Oct 2006 20:39:06 +0000 (GMT) Received: from www.drule.org (localhost [127.0.0.1]) by drule.org (Postfix) with ESMTP id 7C05241C6; Thu, 19 Oct 2006 20:38:57 +0000 (UTC) Received: from 209.244.4.106 (SquirrelMail authenticated user kev@drule.org) by www.drule.org with HTTP; Thu, 19 Oct 2006 14:39:01 -0600 (MDT) Message-ID: <49298.209.244.4.106.1161290341.squirrel@www.drule.org> In-Reply-To: <20061019135428.GD20328@oppetid.no> References: <20061019135428.GD20328@oppetid.no> Date: Thu, 19 Oct 2006 14:39:01 -0600 (MDT) Subject: Re: Swappiness setting on a linux pg server From: "Kevin" To: "Tobias Brox" Cc: pgsql-performance@postgresql.org User-Agent: SquirrelMail/1.4.7 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal 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/423 X-Sequence-Number: 21552 > 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