Re: Excessive PostmasterIsAlive calls slow down WAL redo

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Excessive PostmasterIsAlive calls slow down WAL redo
Date: 2018-04-11 10:22:28
Message-ID: 95b9a140-04ef-0db4-62c7-2a38d983aff6@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/04/18 04:36, Thomas Munro wrote:
> On Tue, Apr 10, 2018 at 12:53 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
>> I coincidentally got pinged about our current approach causing
>> performance problems on FreeBSD and started writing a patch. The
>> problem there appears to be that constantly attaching events to the read
>> pipe end, from multiple processes, causes significant contention inside
>> the kernel. Which isn't that surprising. That's distinct from the
>> problem netbsd/openbsd reported a while back (superflous wakeups).
>>
>> That person said he'd work on adding an equivalent of linux'
>> prctl(PR_SET_PDEATHSIG) to FreeBSD.
>
> Just an idea, not tested: what about a reusable WaitEventSet with zero
> timeout? Using the kqueue patch, that'd call kevent() which'd return
> immediately and tell you if any postmaster death notifications had
> arrive on your queue since last time you asked. It doesn't even touch
> the pipe, or any other kernel objects apart from your own queue IIUC.

Hmm. In PostmasterIsAlive(), you'd still need to call kevent() to check
if postmaster has died. It would just replace the current read() syscall
on the pipe with the kevent() syscall. Is it faster?

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2018-04-11 10:39:30 'make check' fails
Previous Message Jeevan Chalke 2018-04-11 10:00:33 Re: [sqlsmith] Failed assertion in create_gather_path