pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Track total amounts of times spent writing and syncing WAL data
Date: Tue, 09 Mar 2021 07:54:57 +0000
Message-ID: <E1lJXCj-0006vu-FH@gemulon.postgresql.org> (raw)

Track total amounts of times spent writing and syncing WAL data to disk.

This commit adds new GUC track_wal_io_timing. When this is enabled,
the total amounts of time XLogWrite writes and issue_xlog_fsync syncs
WAL data to disk are counted in pg_stat_wal. This information would be
useful to check how much WAL write and sync affect the performance.

Enabling track_wal_io_timing will make the server query the operating
system for the current time every time WAL is written or synced,
which may cause significant overhead on some platforms. To avoid such
additional overhead in the server with track_io_timing enabled,
this commit introduces track_wal_io_timing as a separate parameter from
track_io_timing.

Note that WAL write and sync activity by walreceiver has not been tracked yet.

This commit makes the server also track the numbers of times XLogWrite
writes and issue_xlog_fsync syncs WAL data to disk, in pg_stat_wal,
regardless of the setting of track_wal_io_timing. This counters can be
used to calculate the WAL write and sync time per request, for example.

Bump PGSTAT_FILE_FORMAT_ID.

Bump catalog version.

Author: Masahiro Ikeda
Reviewed-By: Japin Li, Hayato Kuroda, Masahiko Sawada, David Johnston, Fujii Masao
Discussion: https://postgr.es/m/0509ad67b585a5b86a83d445dfa75392@oss.nttdata.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ff99918c625a84c91e7391db9032112ec8653623

Modified Files
--------------
doc/src/sgml/config.sgml                      | 23 +++++++-
doc/src/sgml/monitoring.sgml                  | 62 ++++++++++++++++++++++
doc/src/sgml/wal.sgml                         | 29 ++++++++++
src/backend/access/transam/xlog.c             | 54 ++++++++++++++++++-
src/backend/catalog/system_views.sql          |  4 ++
src/backend/postmaster/checkpointer.c         |  2 +-
src/backend/postmaster/pgstat.c               | 76 +++++++++++++++++++++------
src/backend/postmaster/walwriter.c            |  3 ++
src/backend/utils/adt/pgstatfuncs.c           | 21 ++++++--
src/backend/utils/misc/guc.c                  |  9 ++++
src/backend/utils/misc/postgresql.conf.sample |  1 +
src/include/access/xlog.h                     |  1 +
src/include/catalog/catversion.h              |  2 +-
src/include/catalog/pg_proc.dat               |  6 +--
src/include/pgstat.h                          | 15 +++++-
src/test/regress/expected/rules.out           |  6 ++-
16 files changed, 285 insertions(+), 29 deletions(-)



Message-ID: <E1lJXCj-0006vu-FH@gemulon.postgresql.org>
Permalink:  ../E1lJXCj-0006vu-FH@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lJXCj-0006vu-FH@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: fujii@postgresql.org
  Subject: Re: pgsql: Track total amounts of times spent writing and syncing WAL data
  In-Reply-To: <E1lJXCj-0006vu-FH@gemulon.postgresql.org>
  References: <E1lJXCj-0006vu-FH@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