pgbouncer

PgBouncer

Channel Revision Published Runs on
latest/stable 5 17 Jan 2022
Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04
1/stable 642 04 Feb 2025
Ubuntu 22.04 Ubuntu 20.04
1/stable 641 04 Feb 2025
Ubuntu 22.04 Ubuntu 20.04
1/stable 640 04 Feb 2025
Ubuntu 22.04 Ubuntu 20.04
1/stable 639 04 Feb 2025
Ubuntu 22.04 Ubuntu 20.04
1/candidate 642 29 Jan 2025
Ubuntu 22.04 Ubuntu 20.04
1/candidate 641 29 Jan 2025
Ubuntu 22.04 Ubuntu 20.04
1/candidate 640 29 Jan 2025
Ubuntu 22.04 Ubuntu 20.04
1/candidate 639 29 Jan 2025
Ubuntu 22.04 Ubuntu 20.04
1/beta 642 29 Jan 2025
Ubuntu 22.04 Ubuntu 20.04
1/beta 641 29 Jan 2025
Ubuntu 22.04 Ubuntu 20.04
1/beta 640 29 Jan 2025
Ubuntu 22.04 Ubuntu 20.04
1/beta 639 29 Jan 2025
Ubuntu 22.04 Ubuntu 20.04
1/edge 682 05 Mar 2025
Ubuntu 22.04 Ubuntu 20.04
1/edge 681 05 Mar 2025
Ubuntu 22.04 Ubuntu 20.04
1/edge 680 05 Mar 2025
Ubuntu 22.04 Ubuntu 20.04
1/edge 679 05 Mar 2025
Ubuntu 22.04 Ubuntu 20.04
juju deploy pgbouncer --channel 1/stable
Show information

Platform:

Ubuntu
22.04 20.04 18.04 16.04

Learn about configurations >

  • listen_port | int

    Default: 6432

    The port on which pgbouncer listens for traffic. Corresponds to listen_port in pgbouncer config.

  • max_db_connections | int

    Default: 100

    Do not allow more than this many server connections per database (regardless of user). This considers the PgBouncer database that the client has connected to, not the PostgreSQL database of the outgoing connection.

    Note that when you hit the limit, closing a client connection to one pool will not immediately allow a server connection to be established for another pool, because the server connection for the first pool is still open. Once the server connection closes (due to idle timeout), a new server connection will immediately be opened for the waiting pool.

    This is used to calculate the following pgbouncer.ini config options, which are documented in the pgbouncer config docs here: https://www.pgbouncer.org/config.html.

    • Firstly, the number of pgbouncer instances is calculated based on the number of CPU cores in the current deployment.
    • effective DB connections = max_db_connections / pgbouncer instances
    • default_pool_size = effective connections / 2
    • min_pool_size = effective connections / 4
    • reserve_pool_size = effective connections / 4

    If max_db_connections is set to 0, the derivatives are set thusly, based on pgbouncer defaults:

    • default_pool_size = 20
    • min_pool_size = 10
    • reserve_pool_size = 10

    0 = unlimited.

  • metrics_port | int

    Default: 9127

    The port on which the pgbouncer prometheus exporter serves metrics.

  • pool_mode | string

    Default: session

    Specifies when a server connection can be reused by other clients. Can be one of the following values:

    session Server is released back to pool after client disconnects. Default.

    transaction Server is released back to pool after transaction finishes.

    statement Server is released back to pool after query finishes. Transactions spanning multiple statements are disallowed in this mode.

  • vip | string

    Virtual IP to use to front pgbouncer units. Used only in case of external node connection.