Re: race condition in sync rep

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: race condition in sync rep
Date: 2011-03-27 11:46:42
Message-ID: AANLkTimCPyy401nyqzLwD5pX9kj2763JD1yaYvu13W-H@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 26, 2011 at 5:51 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Sat, Mar 26, 2011 at 12:41 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>> Is it? Sync rep requires fsync on the standby. If you then explicitly
>> turn off fsync on the standby then it has a performance impact, as
>> documented.
>
> Actually, it doesn't, now that you fixed this.  Before:
>
> [rhaas(at)office ~]$ pgbench -T 10
> starting vacuum...end.
> transaction type: TPC-B (sort of)
> scaling factor: 25
> query mode: simple
> number of clients: 1
> number of threads: 1
> duration: 10 s
> number of transactions actually processed: 27
> tps = 0.099386 (including connections establishing)
> tps = 0.099389 (excluding connections establishing)
> [rhaas(at)office ~]$ pgbench -T 10
> starting vacuum...end.
> transaction type: TPC-B (sort of)
> scaling factor: 25
> query mode: simple
> number of clients: 1
> number of threads: 1
> duration: 10 s
> number of transactions actually processed: 425
> tps = 42.442185 (including connections establishing)
> tps = 42.468972 (excluding connections establishing)
>
> The first one - run with code from a few weeks ago - hung up on the
> 27th transaction and was stuck there until the next checkpoint
> completed.  The second one was run with the latest code and no longer
> hangs - and in fact it's now faster than running with fsync=on,
> exactly as one would expect.  Or at least as *I* expected.

Are the master and standby on same system or are they separated by a network?

I'm surprised that a network roundtrip takes less time than the
backend takes to mark clog and then queue for the SyncRepLock.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2011-03-27 11:57:52 Re: Lock problem with autovacuum truncating heap
Previous Message Robert Haas 2011-03-27 11:17:11 Re: DO hint update?