PgBouncer connection pooling
PostgreSQL forks a process per connection, so hundreds of short-lived application connections get expensive quickly. PgBouncer sits in front of the database, keeps a small pool of server connections and multiplexes many client connections over it. Jarwis installs and manages it like any other load balancer on PostgreSQL and Patroni clusters.
6432, pool mode Transaction and user authentication auth_query.Install
Open the cluster's Load Balancers tab (?tab=load-balancers), choose + Add and pick PgBouncer. Choose the node to install it on and the client port (default 6432). On a Patroni cluster you can install it on a cluster member — no extra node is required — or on a free node. Optional Collect logs sends the PgBouncer log to the central Logs view.
Pool mode
transaction (default) returns the server connection after each transaction and gives the best multiplexing. session holds it for the whole client session; use it if your application relies on session state (temp tables, SET, advisory locks).
Authentication
auth_query (default): PgBouncer looks the user up in PostgreSQL itself, so new roles work immediately. auth_file: Jarwis copies login roles into PgBouncer's user list — use Sync users after adding roles.
Pool sizing
Defaults are 1000 client connections and a default pool of 20 server connections. You can also set minimum pool, reserve pool and a per-database connection cap.
Follows failover
On a Patroni cluster PgBouncer always points at the current leader. A small follower service on the PgBouncer node checks which member is the leader every couple of seconds and re-targets PgBouncer when it changes — after a switchover or an automatic failover your application keeps using the same host and port. It does not depend on the controller being reachable. While an election is in progress the target is left unchanged until a new leader appears.
Change settings
Open the PgBouncer row to see its state and change the pool mode, authentication mode and pool sizes. Saving regenerates the configuration and reloads PgBouncer without dropping connected clients. Passwords and generated secrets are never displayed.
Monitoring and alerts
The agent reads PgBouncer's pool statistics and the Load Balancers tab shows waiting clients, longest wait and pool utilisation. Two alert rules are provided as defaults: clients waiting (more than 10 waiting) and pool saturated (over 90% used). A health probe also connects through the pooler's port to verify the whole client → leader path.
Connecting
Point the application at <pgbouncer-host>:6432 with the same database, user and password it used before. A session through PgBouncer lands on the leader, so writes work as usual.