Latches, signals, and waiting - Mailing list pgsql-hackers

From Tom Lane
Subject Latches, signals, and waiting
Date
Msg-id 4348.1284558930@sss.pgh.pa.us
Whole thread Raw
Responses Re: Latches, signals, and waiting  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Re: Latches, signals, and waiting  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-hackers
heikki@postgresql.org (Heikki Linnakangas) writes:
> Log Message:
> -----------
> Use a latch to make startup process wake up and replay immediately when
> new WAL arrives via streaming replication. This reduces the latency, and
> also allows us to use a longer polling interval, which is good for energy
> efficiency.

> We still need to poll to check for the appearance of a trigger file, but
> the interval is now 5 seconds (instead of 100ms), like when waiting for
> a new WAL segment to appear in WAL archive.

This is just speculation at this point, because I haven't taken time
to think through the details, but couldn't we improve on that still
further?

There are always going to be some conditions that we have to poll for,
in particular death of the postmaster (since Unix unaccountably fails
to provide a SIGPARNT signal condition :-().  However postmaster death
isn't really something that needs an instant response IMO.  I would like
to get the wakeup-and-poll interval for our background processes down to
a minute or so; so far as postmaster death goes that doesn't seem like
an unacceptable response time.

So I'm wondering if we couldn't eliminate the five-second sleep
requirement here too.  It's problematic anyhow, since somebody looking
for energy efficiency will still feel it's too short, while somebody
concerned about fast failover will feel it's too long.  Could the
standby triggering protocol be modified so that it involves sending a
signal, not just creating a file?  (One issue is that it's not clear
what that'd translate to on Windows.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Serializable Snapshot Isolation
Next
From: Heikki Linnakangas
Date:
Subject: Re: Latches, signals, and waiting