Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id 07CFC2E0079 for ; Sat, 19 Apr 2008 06:23:06 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 72045-03 for ; Sat, 19 Apr 2008 06:22:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from westnet.com (westnet.com [216.187.52.2]) by developer.postgresql.org (Postfix) with ESMTP id 8B3F82E006F for ; Sat, 19 Apr 2008 06:23:02 -0300 (ADT) Received: from westnet.com (localhost [127.0.0.1]) by westnet.com (8.14.0/8.14.0) with ESMTP id m3J9Mlui010214; Sat, 19 Apr 2008 05:22:47 -0400 (EDT) Received: from localhost (gsmith@localhost) by westnet.com (8.14.0/8.13.2/Submit) with ESMTP id m3J9Mk6s010210; Sat, 19 Apr 2008 05:22:47 -0400 (EDT) X-Authentication-Warning: westnet.com: gsmith owned process doing -bs Date: Sat, 19 Apr 2008 05:22:46 -0400 (EDT) From: Greg Smith X-X-Sender: gsmith@westnet.com To: Marinos Yannikos cc: pgsql-performance@postgresql.org Subject: Re: Background writer underemphasized ... In-Reply-To: <48079AED.8090906@geizhals.at> Message-ID: References: <480619CA.2080904@geizhals.at> <48079AED.8090906@geizhals.at> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/284 X-Sequence-Number: 29777 On Thu, 17 Apr 2008, Marinos Yannikos wrote: > Controller is > http://www.infortrend.com/main/2_product/es_a08(12)f-g2422.asp with 2GB > cache (writeback was enabled). Ah. Sometimes these fiber channel controllers can get a little weird (compared with more direct storage) when the cache gets completely filled. If you think about it, flushing 2GB out takes takes a pretty significant period amount of time even at 4Gbps, and once all the caches at every level are filled it's possible for that to turn into a bottleneck. Using the background writer more assures that the cache on the controller is going to be written to aggressively, so it may be somewhat filled already come checkpoint time. If you leave the writer off, when the checkpoint comes you're much more likely to have the full 2GB available to absorb a large block of writes. You suggested a documentation update; it would be fair to suggest that there are caching/storage setups where even the 8.3 BGW might just be getting in the way. The right thing to do there is just turn it off altogether, which should work a bit better than the exact tuning you suggested. > Perhaps the background writer takes too long to find the required number of > dirty pages among the 16GB shared buffers (currently), which should be mostly > clean. That would only cause a minor increase in CPU usage. You certainly don't want to reduce shared_buffers for all the reasons you list. > I was under the impression that wal_buffers should be kept at/above the size > of tyical transactions. It doesn't have to be large enough to hold a whole transaction, just big enough that when it fills and a write is forced that write isn't trivially small (and therefore wasteful in terms of I/O size). There's a fairly good discussion of what's actually involved here at http://archives.postgresql.org/pgsql-advocacy/2003-02/msg00053.php ; as I suggested, I've seen and heard others report small improvements in raising from the tiny default value to the small MB range, but beyond that you're just wasting RAM that could buffer database pages instead. -- * Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD