Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save varun-dhawan/e86a6c18066c25fc9ca069503ee680d3 to your computer and use it in GitHub Desktop.
Save varun-dhawan/e86a6c18066c25fc9ca069503ee680d3 to your computer and use it in GitHub Desktop.
title description ms.service ms.subservice ms.topic ms.author ms.date
Azure Database for PostgreSQL Flexible Server - PgBouncer metrics (Preview)
Metrics to monitor PgBouncer
postgresql
flexible-server
conceptual
varun.dhawan
11/01/2022

Azure Postgres Flexible Server - PgBouncer metrics (Preview) [Zn Sem]

PgBouncer is an open-source, lightweight, single-binary connection pooler for PostgreSQL. It can pool connections to one or more databases (on possibly different servers) and serve clients over TCP and Unix domain sockets. Azure Database for PostgreSQL – Flexible Server offers PgBouncer as a built-in connection pooling solution.

PgBouncer also provides an internal database that you can connect to called pgbouncer. Once connected to the database you can execute SHOW commands that provide information on the current state of pgbouncer.

  • SHOW HELP - list all the available show commands
  • SHOW POOLS — show number of connections in each state for each pool
  • SHOW DATABASES - show current applied connection limits for each database
  • SHOW STATS - show stats on requests and traffic for every database

Enabling PgBouncer metrics

  • Most of these new metrics are disabled by default
  • To enable these metrics, please turn ON the server parameter pgbouncer.diagnostics.
    • This parameter is dynamic, and will not require instance restart.

List of PgBouncer metrics

Metrics ID Description SHOW commands Dimension Status
pgbouncer.pools.cl_active Client connections linked to server connection and able to process queries SHOW POOLS DatabaseName Committed (M26)
pgbouncer.pools.cl_waiting Client connections waiting on a server connection SHOW POOLS DatabaseName Committed (M26)
pgbouncer.pools.sv_active Server connections linked to a client connection SHOW POOLS DatabaseName Committed (M26)
pgbouncer.pools.sv_idle Server connections idle and ready for a client query SHOW POOLS DatabaseName Committed (M26)
pgbouncer.database.active_connections Current number of connections (client-2-pgBouncer) SHOW DATABASES DatabaseName Committed (M26)
pgbouncer.pools.pools_per_database Total no. of pools per DB CUSTOM METRICS DatabaseName Committed (M26)

Reference

Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment