pgsql: Optimize xid/subxid searches in XidInMVCCSnapshot().

From: John Naylor <john(dot)naylor(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Optimize xid/subxid searches in XidInMVCCSnapshot().
Date: 2022-08-11 02:49:28
Message-ID: E1oLyGE-000DPC-W5@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Optimize xid/subxid searches in XidInMVCCSnapshot().

As reported by Yura Sokolov, scanning the snapshot->xip array has
noticeable impact on scalability when there are a large number of
concurrent writers. Use the optimized (on x86-64) routine from b6ef16756
to speed up searches through the [sub]xip arrays. One benchmark showed
a 5% increase in transaction throughput with 128 concurrent writers,
and a 50% increase in a pathological case of 1024 writers. While a hash
table would have scaled even better, it was ultimately rejected because
of concerns around code complexity and memory allocation. Credit to Andres
Freund for the idea to optimize linear search using SIMD instructions.

Nathan Bossart

Reviewed by: Andres Freund, John Naylor, Bharath Rupireddy, Masahiko Sawada
Discussion: https://postgr.es/m/20220713170950.GA3116318%40nathanxps13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/37a6e5df3713498a21942dae2ed3122bba5b9f50

Modified Files
--------------
src/backend/utils/time/snapmgr.c | 28 +++++++---------------------
1 file changed, 7 insertions(+), 21 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2022-08-11 04:52:23 pgsql: Fix catalog lookup with the wrong snapshot during logical decodi
Previous Message Robert Haas 2022-08-10 18:03:31 pgsql: Move basebackup code to new directory src/backend/backup