From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Reduce ProcArrayLock contention by removing backends in batches.
Date: Thu, 06 Aug 2015 16:05:52 +0000
Message-ID: <E1ZNNg0-0003hW-Kz@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Reduce ProcArrayLock contention by removing backends in batches.
When a write transaction commits, it must clear its XID advertised via
the ProcArray, which requires that we hold ProcArrayLock in exclusive
mode in order to prevent concurrent processes running GetSnapshotData
from seeing inconsistent results. When many processes try to commit
at once, ProcArrayLock must change hands repeatedly, with each
concurrent process trying to commit waking up to acquire the lock in
turn. To make things more efficient, when more than one backend is
trying to commit a write transaction at the same time, have just one
of them acquire ProcArrayLock in exclusive mode and clear the XIDs of
all processes in the group. Benchmarking reveals that this is much
more efficient at very high client counts.
Amit Kapila, heavily revised by me, with some review also from Pavan
Deolasee.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/0e141c0fbb211bdd23783afa731e3eef95c9ad7a
Modified Files
--------------
src/backend/access/transam/README | 3 +
src/backend/storage/ipc/procarray.c | 166 ++++++++++++++++++++++++++++++-----
src/backend/storage/lmgr/proc.c | 5 ++
src/include/storage/proc.h | 12 +++
4 files changed, 166 insertions(+), 20 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
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: rhaas@postgresql.org
Subject: Re: pgsql: Reduce ProcArrayLock contention by removing backends in batches.
In-Reply-To: <E1ZNNg0-0003hW-Kz@gemulon.postgresql.org>
References: <E1ZNNg0-0003hW-Kz@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