Re: pgsql: snapshot scalability: cache snapshots using a xact completion co

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: snapshot scalability: cache snapshots using a xact completion co
Date: 2020-08-18 04:52:46
Message-ID: 20200818045246.GC3813@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Tue, Aug 18, 2020 at 04:30:21AM +0000, Andres Freund wrote:
> snapshot scalability: cache snapshots using a xact completion counter.
>
> Previous commits made it faster/more scalable to compute snapshots. But not
> building a snapshot is still faster. Now that GetSnapshotData() does not
> maintain RecentGlobal* anymore, that is actually not too hard:
>
> This commit introduces xactCompletionCount, which tracks the number of
> top-level transactions with xids (i.e. which may have modified the database)
> that completed in some form since the start of the server.
>
> We can avoid rebuilding the snapshot's contents whenever the current
> xactCompletionCount is the same as it was when the snapshot was
> originally built. Currently this check happens while holding
> ProcArrayLock. While it's likely possible to perform the check without
> acquiring ProcArrayLock, it seems better to do that separately /
> later, some careful analysis is required. Even with the lock this is a
> significant win on its own.
>
> On a smaller two socket machine this gains another ~1.03x, on a larger
> machine the effect is roughly double (earlier patch version tested
> though). If we were able to safely avoid the lock there'd be another
> significant gain on top of that.

spurfowl and more animals are telling us that this commit has broken
2PC:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=spurfowl&dt=2020-08-18%2004%3A31%3A11
--
Michael

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-08-18 04:55:22 Re: pgsql: snapshot scalability: cache snapshots using a xact completion co
Previous Message Andres Freund 2020-08-18 04:30:21 pgsql: snapshot scalability: cache snapshots using a xact completion co

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-08-18 04:55:22 Re: pgsql: snapshot scalability: cache snapshots using a xact completion co
Previous Message Andres Freund 2020-08-18 04:30:21 pgsql: snapshot scalability: cache snapshots using a xact completion co