Re: BGWriter latch, power saving

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BGWriter latch, power saving
Date: 2012-01-04 07:24:32
Message-ID: 4F03FEB0.7000304@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04.01.2012 07:58, Peter Geoghegan wrote:
> As part of the ongoing effort to reduce wake-ups when idle/power
> consumption, the attached patch modifies the background writer to
> hibernate in ten second bursts once the bgwriter laps the clock sweep.
> It's fairly well commented, so a description of how it works here
> would probably be redundant. The most controversial aspect of this
> patch is the fact that it adds a SetLatch() call to MarkBufferDirty(),
> though I went to some lengths to ensure that that call will very
> probably find the latch already set when it actually matters, so it
> only checks a single flag.

I think SetBufferCommitInfoNeedsSave() needs the same treatment as
MarkBufferDirty(). And it would probably be good to only set the latch
if the buffer wasn't dirty already. Setting a latch that's already set
is fast, but surely it's even faster to not even try.

> Thoughts? I can produce benchmarks, if that helps, but I think it's
> fairly unlikely that the patch introduces a measurable performance
> regression.

Yeah, I'd like to see a micro-benchmark of a worst-case scenario. I'm a
bit worried about the impact on systems with a lot of CPUs. If you have
a lot of CPUs writing to the same cache line that contains the latch's
flag, that might get expensive.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2012-01-04 08:11:19 Re: BGWriter latch, power saving
Previous Message Kevin Grittner 2012-01-04 07:12:43 Re: 16-bit page checksums for 9.2