--- title: Azure Database for PostgreSQL Flexible Server - PgBouncer metrics (Preview) description: Metrics to monitor PgBouncer ms.service: postgresql ms.subservice: flexible-server ms.topic: conceptual ms.author: varun.dhawan ms.date: 11/01/2022 --- # Azure Postgres Flexible Server - PgBouncer metrics (Preview) ## PgBouncer monitoring Postgres is a powerful and popular open-source relational database management system (RDBMS). However, as the number of connections to a Postgres database grows, managing and monitoring those connections can become a challenge. That's where connection pooling comes in. PgBouncer probably the most popular connection pooler in postgrtes. It is a lightweight connection pooler that helps to improve the performance and scalability of your Postgres databases by managing and reusing database connections. By pooling connections, PgBouncer reduces the number of connections that need to be opened and closed, reducing the load on your Postgres server and improving overall performance. Azure Database for PostgreSQL – Flexible Server offers PgBouncer as a [built-in option](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-pgbouncer#enabling-and-configuring-pgbouncer), wherein customers can easily enable PgBouncer from Azure Postgres server parameters and update the app connection string to talk to PgBouncer on port 6432, rather than directly to the database server. We are exposing 6 new metrics that customers can use to monitor PgBouncer performance and identify any potential issues. Each metric is emitted at a 1 minute frequency, and has up to 93 days of retenion. Customers can configure alerts on the metrics and can also access the new metrics dimensions, to split and filter the metrics data on database name. ## Enabling PgBouncer metrics * Most of these new metrics are **disabled** by default * For Pgbouncer metrics to work, server parameters `pgbouncer.enabled` and `metrics.pgbouncer_diagnostics` have to be enabled * These parameters are dynamic, and will not require instance restart. ## List of PgBouncer metrics |Display Name |Metrics ID |Unit |Description |Dimension |Default enabled| |----------------------------------------|--------------------------|-----|-------------------------------------------------------------------------------------|------------|---------------| |**Active client connections** (Preview) |client_connections_active |Count|Connections from clients which are associated with a PostgreSQL connection |DatabaseName|No | |**Waiting client connections** (Preview)|client_connections_waiting|Count|Connections from clients that are waiting for a PostgreSQL connection to service them|DatabaseName|No | |**Active server connections** (Preview) |server_connections_active |Count|Connections to PostgreSQL that are in use by a client connection |DatabaseName|No | |**Idle server connections** (Preview) |server_connections_idle |Count|Connections to PostgreSQL that are idle, ready to service a new client connection |DatabaseName|No | |**Total pooled connections** (Preview) |total_pooled_connections |Count|Current number of pooled connections |DatabaseName|No | |**Number of connection pools** (Preview)|num_pools |Count|Total number of connection pools |DatabaseName|No | ## References * PgBouncer Admin Console - https://www.pgbouncer.org/usage.html ## Team * Engineering - michaellu@microsoft.com, Andrey.Chudnovskiy@microsoft.com * Product - Varun.Dhawan@microsoft.com, gennadyk@microsoft.com