0

I expect min_pool_size server connections to be created when PgBouncer starts. However, that does not happen (for example, there are ~46 connections, and after some time ~80 ...).

Is it possible that PgBouncer does not create all the connections immediately, but once min_pool_size is reached then such number is being maintained. If yes, is there a way to change such behavior? Isn't that the sole purpose of that config?

Docs: Add more server connections to pool if below this number. Improves behavior when the normal load suddently comes back after a period of total inactivity.

(my pgbouncer.ini)

min_pool_size = 200
default_pool_size = 550

P.S. pool_size is not set at database level (cap value for min_pool_size), so default_pool_size is used.

Pocke
  • 23
  • 5

1 Answers1

0

Since "a period of total inactivity" is not the same thing as a "new start up of pgbouncer", then no, launching connections upon start up is not the sole purpose, and indeed is only tangentially a purpose at all.

It will launch new connections merely to satisfy min_pool_size only every 1/3 of a second. A setting which it appears is not configurable without a re-compile (being the value of "full_maint_period" from "janitor.c"). You could quibble about the exact nature of the throttling that should be used, but clearly you don't want it to be so busy opening connections merely on spec that it can't promptly service incoming requests which have an actual client behind them.

jjanes
  • 37,812
  • 5
  • 27
  • 34