Mr.A.N
Mr.A.N

Reputation: 31

Confusion with default_pool_size and max_connection on PgBouncer

I have a single database and user pair with following configuration. I am confused when setting up default pool size for the pgbouncer. Can anyone explain what its about ?

I have 300 max_connection set for database. Core count is 0 as its shared cpu on cloud.

 pool_mode = transaction
 max_client_conn = 600
 server_idle_timeout = 10
 server_lifetime = 3600
 query_wait_timeout = 120
 default_pool_size = ??

Upvotes: 0

Views: 3276

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247655

default_pool_size is the number of database connection that can be in one connection pool. With transaction pooling, that would be the limit for concurrent transactions per database and user.

You should set the limit small enough that there is no danger of overloading the database. If your transaction have no idle time, that means not to allow more database sessions than the number of cores or of concurrent I/O requests you can handle.

Additional remarks about your settings:

  • server_idle_timeout = 10: that is way too small. The whole point of connection pooling is to Keep those sessions open.

  • max_connections = 300 is extremely high. Make sure that you actually have way fewer connections.

Upvotes: 1

Related Questions