pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Collect statistics about SLRU caches
3+ messages / 3 participants
[nested] [flat]

* pgsql: Collect statistics about SLRU caches
@ 2020-04-02 00:39  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: Tomas Vondra @ 2020-04-02 00:39 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Collect statistics about SLRU caches

There's a number of SLRU caches used to access important data like clog,
commit timestamps, multixact, asynchronous notifications, etc. Until now
we had no easy way to monitor these shared caches, compute hit ratios,
number of reads/writes etc.

This commit extends the statistics collector to track this information
for a predefined list of SLRUs, and also introduces a new system view
pg_stat_slru displaying the data.

The list of built-in SLRUs is fixed, but additional SLRUs may be defined
in extensions. Unfortunately, there's no suitable registry of SLRUs, so
this patch simply defines a fixed list of SLRUs with entries for the
built-in ones and one entry for all additional SLRUs. Extensions adding
their own SLRU are fairly rare, so this seems acceptable.

This patch only allows monitoring of SLRUs, not tuning. The SLRU sizes
are still fixed (hard-coded in the code) and it's not entirely clear
which of the SLRUs might need a GUC to tune size. In a way, allowing us
to determine that is one of the goals of this patch.

Bump catversion as the patch introduces new functions and system view.

Author: Tomas Vondra
Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/flat/20200119143707.gyinppnigokesjok@development

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/28cac71bd368788d1ab22f048eef211641fb1283

Modified Files
--------------
doc/src/sgml/monitoring.sgml         |  97 ++++++++++++
src/backend/access/transam/slru.c    |  23 +++
src/backend/catalog/system_views.sql |  14 ++
src/backend/postmaster/pgstat.c      | 297 +++++++++++++++++++++++++++++++++++
src/backend/utils/adt/pgstatfuncs.c  |  91 +++++++++++
src/include/catalog/catversion.h     |   2 +-
src/include/catalog/pg_proc.dat      |  15 ++
src/include/pgstat.h                 |  65 ++++++++
src/test/regress/expected/rules.out  |  10 ++
9 files changed, 613 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pgsql: Collect statistics about SLRU caches
@ 2020-04-07 16:54  Thomas Munro <thomas.munro@gmail.com>
  parent: Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: Thomas Munro @ 2020-04-07 16:54 UTC (permalink / raw)
  To: Tomas Vondra <tomas.vondra@postgresql.org>; +Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>

Hi Tomas,

In pgstat.c,

+       elog(LOG, "msg->m_index = %d", msg->m_index);

Looks like unintentional debugging stuff?





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pgsql: Collect statistics about SLRU caches
@ 2020-04-07 17:19  Tomas Vondra <tomas.vondra@2ndquadrant.com>
  parent: Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Tomas Vondra @ 2020-04-07 17:19 UTC (permalink / raw)
  To: Thomas Munro <thomas.munro@gmail.com>; +Cc: Tomas Vondra <tomas.vondra@postgresql.org>; pgsql-committers <pgsql-committers@lists.postgresql.org>

On Wed, Apr 08, 2020 at 04:54:40AM +1200, Thomas Munro wrote:
>Hi Tomas,
>
>In pgstat.c,
>
>+       elog(LOG, "msg->m_index = %d", msg->m_index);
>
>Looks like unintentional debugging stuff?
>

Yes, sorry about that. Will fix.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services 





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2020-04-07 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02 00:39 pgsql: Collect statistics about SLRU caches Tomas Vondra <tomas.vondra@postgresql.org>
2020-04-07 16:54 ` Thomas Munro <thomas.munro@gmail.com>
2020-04-07 17:19   ` Tomas Vondra <tomas.vondra@2ndquadrant.com>

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