Re: Reduced power consumption in WAL Writer process

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Peter Geoghegan <peter(at)2ndquadrant(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reduced power consumption in WAL Writer process
Date: 2011-07-14 08:57:34
Message-ID: CAHGQGwFnHYqNdejDauTUVL3R+3A2utNxcMQw_yH9uE4Yq1Xq-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 14, 2011 at 5:39 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
> On Wed, Jul 13, 2011 at 10:56 PM, Peter Geoghegan <peter(at)2ndquadrant(dot)com> wrote:
>> Attached is patch for the WAL writer that removes its tight polling
>> loop (which probably doesn't get hit often in practice, as we just
>> sleep if wal_writer_delay is under a second), and, at least
>> potentially, reduces power consumption when idle by using a latch.
>>
>> I will break all remaining power consumption work down into
>> per-auxiliary process patches. I think that this is appropriate - if
>> we hit a snag on one of the processes, there is no need to have that
>> hold up everything.
>>
>> I've commented that we handle all expected signals, and therefore we
>> shouldn't worry about having timeout invalidated by signals, just as
>> with the archiver. Previously, we didn't even worry about Postmaster
>> death within the tight polling loop, presumably because
>> wal_writer_delay is typically small enough to avoid that being a
>> problem. I thought that WL_POSTMASTER_DEATH might be superfluous here,
>> but then again there is a codepath specifically for the case where
>> wal_writer_delay exceeds one second, so it is included in this initial
>> version.
>>
>> Comments?
>
> ISTM that this in itself isn't enough to reduce power consumption.
>
> Currently the only people that use WALWriter are asynchronous commits,
> so we should include within RecordTransactionCommit() a SetLatch()
> command for the WALWriter.
>
> That way we can have WALWriter sleep until its needed.

+1

Currently walwriter might write out the WAL before a transaction commits.
IOW, walwriter tries to write out the WAL in wal_buffers in every wakeups.
This might be useful for long transaction which generates lots of WAL
records before commit. So we should call SetLatch() in XLogInsert() instead
of RecordTransactionCommit()? Though I'm not sure how much walwriter
improves the performance of synchronous commit case..

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2011-07-14 09:41:27 Re: WIP: Fast GiST index build
Previous Message Heikki Linnakangas 2011-07-14 08:56:58 Re: Small patch for GiST: move childoffnum to child