pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jeff Frost <jeff@pgexperts.com>
Cc: Matheus de Oliveira <matioli.matheus@gmail.com>
Cc: Soni M <diptatapa@gmail.com>
Cc: Heikki Linnakangas <hlinnakangas@vmware.com>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: Postgres Replaying WAL slowly
Date: Tue, 1 Jul 2014 01:17:41 +0200
Message-ID: <20140630231741.GA30918@alap3.anarazel.de> (raw)
In-Reply-To: <24455.1404169460@sss.pgh.pa.us>
References: <20300.1404156750@sss.pgh.pa.us>
	<C64129CF-D034-4311-AD32-09EF048C3E93@pgexperts.com>
	<CAJghg4Lq2rg7mMzRfEartAQK1c83veoW3TWroQsSvXMqBQ9h+w@mail.gmail.com>
	<B22B06CF-2BC0-4AB6-8E3C-FACDF8193F23@pgexperts.com>
	<20140630201523.GV26930@awork2.anarazel.de>
	<943ECC8E-8899-422E-937C-50DE20E1F7AC@pgexperts.com>
	<21474.1404160784@sss.pgh.pa.us>
	<2E438E7D-E3C1-47A1-A1AF-9FE50A14A302@pgexperts.com>
	<571D044B-260A-4E06-ACBC-8869B8F73C0F@pgexperts.com>
	<24455.1404169460@sss.pgh.pa.us>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (33+ messages)  latest in thread

Message-ID: <20140630231741.GA30918@alap3.anarazel.de>
Permalink:  ../20140630231741.GA30918@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20140630231741.GA30918@alap3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: andres@2ndquadrant.com, tgl@sss.pgh.pa.us, jeff@pgexperts.com, matioli.matheus@gmail.com, diptatapa@gmail.com, hlinnakangas@vmware.com
  Subject: Re: Postgres Replaying WAL slowly
  In-Reply-To: <20140630231741.GA30918@alap3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox