pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

Started by Simon Riggsabout 9 years ago4 messagescomitters
Jump to latest
#1Simon Riggs
simon@2ndQuadrant.com

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(-)

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

#2Robert Haas
robertmhaas@gmail.com
In reply to: Simon Riggs (#1)
Re: pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

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

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

#3Simon Riggs
simon@2ndQuadrant.com
In reply to: Robert Haas (#2)
Re: pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

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

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

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Simon Riggs (#1)
Re: pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

Simon Riggs <simon@2ndQuadrant.com> writes:

Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

The buildfarm doesn't like this a bit.

regards, tom lane

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