Thread: [COMMITTERS] pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

[COMMITTERS] pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

From
Simon Riggs
Date:
Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

For normal commits and aborts we already reset PgXact->xmin,
so we can simply avoid running SnapshotResetXmin() twice.

During performance tests by Alexander Korotkov, diagnosis
by Andres Freund showed PgXact array as a bottleneck. After
manual analysis by me of the code paths that touch those
memory locations, I was able to identify extraneous code
in the main transaction commit path.

Avoiding touching highly contented shmem improves concurrent
performance slightly on all workloads, confirmed by tests
run by Ashutosh Sharma and Alexander Korotkov.

Simon Riggs

Discussion: CANP8+jJdXE9b+b9F8CQT-LuxxO0PBCB-SZFfMVAdp+akqo4zfg@mail.gmail.com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6bad580d9e678a0b604883e14d8401d469b06566

Modified Files
--------------
src/backend/access/transam/xact.c |  6 +++---
src/backend/utils/time/snapmgr.c  | 14 ++++++++++++--
src/include/utils/snapmgr.h       |  2 +-
3 files changed, 16 insertions(+), 6 deletions(-)


On Thu, Apr 6, 2017 at 8:35 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
>
> For normal commits and aborts we already reset PgXact->xmin,
> so we can simply avoid running SnapshotResetXmin() twice.
>
> During performance tests by Alexander Korotkov, diagnosis
> by Andres Freund showed PgXact array as a bottleneck. After
> manual analysis by me of the code paths that touch those
> memory locations, I was able to identify extraneous code
> in the main transaction commit path.
>
> Avoiding touching highly contented shmem improves concurrent
> performance slightly on all workloads, confirmed by tests
> run by Ashutosh Sharma and Alexander Korotkov.
>
> Simon Riggs
>
> Discussion: CANP8+jJdXE9b+b9F8CQT-LuxxO0PBCB-SZFfMVAdp+akqo4zfg@mail.gmail.com

Just like the last time you committed this, it seems to have broken
the entire buildfarm.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


On 6 April 2017 at 09:11, Robert Haas <robertmhaas@gmail.com> wrote:

> Just like the last time you committed this, it seems to have broken
> the entire buildfarm.

For different reasons, AFAIU. Investigating already.

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


Simon Riggs <simon@2ndQuadrant.com> writes:
> Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

The buildfarm doesn't like this a bit.

            regards, tom lane