Re: Postgres Replaying WAL slowly

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Postgres Replaying WAL slowly
Дата
Msg-id 20140630231741.GA30918@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: Postgres Replaying WAL slowly  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
On 2014-06-30 19:04:20 -0400, Tom Lane wrote:
> Jeff Frost <jeff@pgexperts.com> writes:
> >>> So it seems like we have a candidate explanation.  I'm a bit surprised
> >>> that StandbyReleaseLocks would get this slow if there are only a dozen
> >>> AccessExclusiveLocks in place at any one time, though.  Perhaps that
> >>> was a low point and there are often many more?
>
> > Since we turned on the monitoring for that, we had a peak of 13,550
> > AccessExclusiveLocks.

Any chance the workload also uses lots of subtransactions?

> Ah ... that's more like a number I can believe something would have
> trouble coping with.  Did you see a noticeable slowdown with this?
> Now that we've seen that number, of course it's possible there was an
> even higher peak occurring when you saw the trouble.
>
> Perhaps there's an O(N^2) behavior in StandbyReleaseLocks, or maybe
> it just takes awhile to handle that many locks.

I don't think there's a O(n^2) in StandbyReleaseLocks() itself, but in
combination with StandbyReleaseLockTree() it looks possibly bad. The
latter will call StandbyReleaseLocks() for every xid/subxid, and each of
the StandbyReleaseLocks() will then trawl the entire RecoveryLockList...

It'd probably be better to implement ReleaseLocksTree() by sorting the
subxid list and bsearch that while iterating RecoveryLockList.

Greetings,

Andres Freund

--
 Andres Freund                       http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Postgres Replaying WAL slowly
Следующее
От: Jeff Frost
Дата:
Сообщение: Re: Postgres Replaying WAL slowly