pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Naylor <john.naylor@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Optimize xid/subxid searches in XidInMVCCSnapshot().
Date: Thu, 11 Aug 2022 02:49:28 +0000
Message-ID: <E1oLyGE-000DPC-W5@gemulon.postgresql.org> (raw)

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



Message-ID: <E1oLyGE-000DPC-W5@gemulon.postgresql.org>
Permalink:  ../E1oLyGE-000DPC-W5@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1oLyGE-000DPC-W5@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: john.naylor@postgresql.org
  Subject: Re: pgsql: Optimize xid/subxid searches in XidInMVCCSnapshot().
  In-Reply-To: <E1oLyGE-000DPC-W5@gemulon.postgresql.org>
  References: <E1oLyGE-000DPC-W5@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox