Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 9DDA49FBAE3 for ; Tue, 15 May 2007 02:18:10 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 77884-05-2 for ; Tue, 15 May 2007 02:18:05 -0300 (ADT) X-Greylist: delayed 00:23:43.64876 by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 777739FB6B1 for ; Tue, 15 May 2007 02:15:07 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from b.mail.sonic.net (b.mail.sonic.net [64.142.19.5]) by svr4.postgresql.org (Postfix) with ESMTP id A9BE95AF044 for ; Tue, 15 May 2007 04:55:20 +0000 (GMT) Received: from newshell.sonic.net (bolt.sonic.net [208.201.242.19]) by b.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id l4F4tG23020132 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 14 May 2007 21:55:16 -0700 Received: from bolt.sonic.net (IDENT:KDCKlLOt+Fnqw6B5k2bTeg5Xasg5bm4p@localhost.localdomain [127.0.0.1]) by newshell.sonic.net (8.13.6/8.12.1) with ESMTP id l4F4tGwu014676; Mon, 14 May 2007 21:55:16 -0700 Received: (from daveg@localhost) by bolt.sonic.net (8.13.6/8.12.1/Submit) id l4F4tGho014675; Mon, 14 May 2007 21:55:16 -0700 Date: Mon, 14 May 2007 21:55:16 -0700 From: daveg To: Greg Smith Cc: pgsql-patches@postgresql.org Subject: Re: Automatic adjustment of bgwriter_lru_maxpages Message-ID: <20070515045516.GE2359@sonic.net> References: <461E108D.6080709@enterprisedb.com> <20070514174531.71E0.ITAGAKI.TAKAHIRO@oss.ntt.co.jp> <9814.1179150750@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/213 X-Sequence-Number: 2313 On Mon, May 14, 2007 at 11:19:23PM -0400, Greg Smith wrote: > On Mon, 14 May 2007, Tom Lane wrote: > > >If you can write something like that, why do we need the parameter at all? > > Couple of reasons: > > -As I already mentioned in my last message, I think it's unwise to let the > LRU writes go completely unbounded. I still think there should be a > maximum, and if there is one it should be tunable. You can get into > situations where the only way to get the LRU writer to work at all is to > set the % to scan fairly high, but that exposes you to way more writes > than you might want per interval in situations where buffers to write are > easy to find. > > -There is considerable coupling between how the LRU and the all background > writers work. There are workloads where the LRU writer is relatively > ineffective, and only the all one really works well. If there is a > limiter on the writes from the all writer, but not on the LRU, admins may > not be able to get the balance between the two they want. I know I > wouldn't. > > -Just because I can advise what is generally the right move, that doesn't > mean it's always the right one. Someone may notice that the maximum pages > written limit is being nailed and not care. > > The last system I really got deep into the background writer mechanics on, > it could be very effective at improving performance and reducing > checkpoint spikes under low to medium loads. But under heavy load, it > just got in the way of the individual backends running, which was > absolutely necessary in order to execute the LRU mechanics (usage_count--) > so less important buffers could be kicked out. I would like people to > still be able to set a tuning such that the background writers were useful > under average loads, but didn't ever try to do too much. It's much more > difficult to do that if bgwriter_lru_maxpages goes away. > > I realized recently the task I should take on here is to run some more > experiments with the latest code and pass along suggested techniques for > producing/identifying the kind of problem conditions I've run into in the > past; then we can see if other people can reproduce them. I got a new > 8-core server I need to thrash anyway and will try and do just that > starting tomorrow. > > For all I know my concerns are strictly a rare edge case. But since the > final adjustments to things like whether there is an upper limit or not > are very small patches compared to what's already been done here, I sent > in what I thought was ready to go because I didn't want to hold up > reviewing the bulk of the code over some of these fine details. Apologies for asking this on the wrong list, but it is at least the right thread. What is the current thinking on bg_writer setttings for systems such as 4 core Opteron with 16GB or 32GB of memory and heavy batch workloads? -dg -- David Gould daveg@sonic.net If simplicity worked, the world would be overrun with insects.