From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Greg Smith <gsmith(at)gregsmith(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Just-in-time Background Writer Patch+Test Results |
Date: | 2007-09-09 01:53:37 |
Message-ID: | 20070909015337.GD6331@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Greg Smith wrote:
> On Sat, 8 Sep 2007, Tom Lane wrote:
>
>> It might be interesting to consider making the delay auto-tune: if you
>> wake up and find nothing (much) to do, sleep longer the next time,
>> conversely shorten the delay when work picks up. Something for 8.4,
>> though, at this point.
>
> I have a couple of pages of notes on how to tune the delay automatically.
> The tricky part are applications that go from 0 to full speed with little
> warning; the first few seconds of the stock market open come to mind.
Maybe have the backends send a signal to bgwriter when they see it
sleeping and are overwhelmed by work. That way, bgwriter can sleep for
a few seconds, safe in the knowledge that somebody else will wake it up
if needed sooner. The way backends would detect that bgwriter is
sleeping is that bgwriter would keep an atomic flag in shared memory,
and it gets set only if it's going to sleep for long (so if it's going
to sleep for (say) 100ms or less, it doesn't set the flag, so the
backends won't signal it). In order to avoid a huge amount of signals
when all backends suddenly start working at the same instant, have the
signal itself be sent only by the first backend that manages to
LWLockConditionalAcquire a lwlock that's only used for that purpose.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-09-09 02:46:05 | Re: WIP patch for latestCompletedXid method of computing snapshot xmax |
Previous Message | Florian G. Pflug | 2007-09-09 00:26:02 | Re: WIP patch for latestCompletedXid method of computing snapshot xmax |