Search code examples
postgresqlpostgresql-9.5pgbouncer

PgBouncer don't start the minimum connections


I have set in pgBouncer this limits

max_client_conn = 2000

default_pool_size = 40

When i execute this SQL in phpPgAdmin, only 2 or 4 connections appears:

SELECT datname, usename, pid, query, query_start
                FROM pg_catalog.pg_stat_activity
                WHERE datname='example'
                ORDER BY usename, pid

This is normal or pgBouncer don't loaded the .ini when started?


Solution

  • The amount of connections in pg_stat_activity depends on the actual load. Also it depend more on pool_mode - if you have pool_mode = session, you will see more sessions just because the are released less often and slower.

    Regarding your options, check out the docs (allowed - is a key word):

    default_pool_size

    How many server connections to allow per user/database pair. Can be overridden in the per-database configuration.

    Default: 20

    and

    max_client_conn

    Maximum number of client connections allowed. When increased then the file descriptor limits should also be increased. Note that actual number of file descriptors used is more than max_client_conn.

    Emphasis mine.