Search code examples
postgresqlspring-bootconnection-poolingpgbouncer

PGBouncer connection pooling for Multiple Spring boot Applications connecting to same Postgres DB?


Just want to validate if this scenario of PG bouncer Connection pooling is possible

  • Have A and B spring boot application connecting to the same DB (only read operations)
  • Does PGbouncer share connection pools across multiple instances of the same applications? - Is there a way to share like 50:50 among applications.

Any insights or docs on these settings on pgbouncer side would be helpful


Solution

  • Yes PGBouncer shares connection pools across multiple instances of the same applications. The config pool_size defines the connection pool size for per database per user combination. So if multiple instances of same application use same user then the connection pool is shared across instances.

    Note that it doesn't share pool with other database or user combination.