PgBouncer 不启动最小连接数

PgBouncer don't start the minimum connections

我在 pgBouncer 中设置了这个限制

max_client_conn = 2000

default_pool_size = 40

当我在 phpPgAdmin 中执行这个 SQL 时,只出现 2 或 4 个连接:

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

这是正常现象还是 pgBouncer 在启动时没有加载 .ini?

pg_stat_activity中的连接数取决于实际负载。此外,它更多地取决于 pool_mode - 如果你有 pool_mode = session,你会看到更多的会话,因为它们的发布频率较低且速度较慢。

关于您的选项,请查看 docs(允许 - 是关键字):

default_pool_size

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

Default: 20

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.

强调我的。