pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: shm_mq: Update mq_bytes_written less often.
Date: Thu, 14 Oct 2021 20:18:22 +0000
Message-ID: <E1mb7BG-0004TL-IW@gemulon.postgresql.org> (raw)

shm_mq: Update mq_bytes_written less often.

Do not update shm_mq's mq_bytes_written until we have written
an amount of data greater than 1/4th of the ring size, unless
the caller of shm_mq_send(v) requests a flush at the end of
the message. This reduces the number of calls to SetLatch(),
and also the number of CPU cache misses, considerably, and thus
makes shm_mq significantly faster.

Dilip Kumar, reviewed by Zhihong Yu and Tomas Vondra. Some
minor cosmetic changes by me.

Discussion: http://postgr.es/m/CAFiTN-tVXqn_OG7tHNeSkBbN+iiCZTiQ83uakax43y1sQb2OBA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/46846433a03dff4f2e08c8a161e54a842da360d6

Modified Files
--------------
src/backend/executor/tqueue.c         |  2 +-
src/backend/libpq/pqmq.c              |  7 +++-
src/backend/storage/ipc/shm_mq.c      | 62 +++++++++++++++++++++++++++++------
src/include/storage/shm_mq.h          |  8 +++--
src/test/modules/test_shm_mq/test.c   |  7 ++--
src/test/modules/test_shm_mq/worker.c |  2 +-
6 files changed, 69 insertions(+), 19 deletions(-)



Message-ID: <E1mb7BG-0004TL-IW@gemulon.postgresql.org>
Permalink:  ../E1mb7BG-0004TL-IW@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mb7BG-0004TL-IW@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: rhaas@postgresql.org
  Subject: Re: pgsql: shm_mq: Update mq_bytes_written less often.
  In-Reply-To: <E1mb7BG-0004TL-IW@gemulon.postgresql.org>
  References: <E1mb7BG-0004TL-IW@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