Re: Excessive PostmasterIsAlive calls slow down WAL redo

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Excessive PostmasterIsAlive calls slow down WAL redo
Дата
Msg-id 20180405182758.32alicjtth7wkz7t@alap3.anarazel.de
обсуждение исходный текст
Ответ на Excessive PostmasterIsAlive calls slow down WAL redo  (Heikki Linnakangas <hlinnaka@iki.fi>)
Ответы Re: Excessive PostmasterIsAlive calls slow down WAL redo  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

On 2018-04-05 10:23:43 +0300, Heikki Linnakangas wrote:
> Profiling that, without any patches applied, I noticed that a lot of time
> was spent in read()s on the postmaster-death pipe, i.e. in
> PostmasterIsAlive(). We call that between *every* WAL record.

> That seems like an utter waste of time. I'm almost inclined to call that a
> performance bug. As a straightforward fix, I'd suggest that we call
> HandleStartupProcInterrupts() in the WAL redo loop, not on every record, but
> only e.g. every 32 records.

I agree this is a performance problem. I do however not like the fix.
ISTM the better approach would be to try to reduce the cost of
PostmasterIsAlive() on common platforms - it should be nearly free if
done right.

One way to achieve that would e.g. to stop ignoring SIGPIPE and instead
check for postmaster death inside the handler, without reacting to
it. Then the the actual PostmasterIsAlive() checks are just a check of a
single sig_atomic_t.

Greetings,

Andres Freund


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: pgsql: New files for MERGE
Следующее
От: Tom Lane
Дата:
Сообщение: Re: WIP: a way forward on bootstrap data