Re: pgbouncer best practices - Mailing list pgsql-general

From Gurjeet Singh
Subject Re: pgbouncer best practices
Date
Msg-id CABwTF4WXR_8thXQA-V6OvCSbifj15-AZ78HGjfMUzAg=Zn=RtA@mail.gmail.com
Whole thread Raw
In response to pgbouncer best practices  (Rita <rmorgan466@gmail.com>)
List pgsql-general
On Fri, Jul 7, 2023 at 9:24 AM Rita <rmorgan466@gmail.com> wrote:
>
> My question are: is there a ratio of max connections and pool i should use in my pgbouncer config?

Short answer: No, there's no recommended ratio for PG max_connections
and pgbouncer pool size.

In pgbouncer, a client connection is matched (forwarded) to a server
connection in the pool. But if all the server connections in the pool
are already busy servicing other client connections, then any newly
active client connections are made to wait until a server connection
is available.

Depending on your workload, there are recommendations for how large to
set the max_connections on Postgres. But for connection poolers like
pgbouncer, there really isn't a recommended upper limit. Since every
connection (whether idle or active) takes up memory (~2kB), the only
upper limit is how much RAM you have available for pgbouncer to use.

It's been a while since I used pgbouncer, so there might be
inconsistencies here. Someone with more current knowledge may want to
correct me.

Best regards,
Gurjeet
http://Gurje.et



pgsql-general by date:

Previous
From: Ben Chobot
Date:
Subject: Re: pgbouncer best practices
Next
From: Rita
Date:
Subject: Re: pgbouncer best practices