[pgpool-general: 5430] Re: connection pooling not working
ishii at sraoss.co.jp
Fri Apr 21 09:39:49 JST 2017
> I'm trying to verify that connection pooling is working on my install of
> pgpool II.
> I've tried connecting using the same [user,database] pair from four
> different terminals (using psql) and when I check the pg_stat_activity
> table, I see four separate connections for that [user,database] pair. My
> understanding is that pgpool will reuse the first connection, and that I
> should expect just one connection in the pg_stat_activity table for that
> [user,database] pair, since I have max_pool configured to 4.
> How can I get the connection pooling to work?
That's normal. Pgpool-II consists of multiple child process and the
connection cache (actually socket file descriptor to PostgreSQL
backend) is kept in their process space. When a new connection request
arrives, one of the child process accept the connection (that's under
control of the kernel). If there's already a cache to backend which
has same user/database pair, it will be reused. Otherwise new
connection will be created. Since the kernel does not necessarily
choose the child process which already has the connection cache, other
child process could create a same user/database connection to
backend. This will continue until all the child process has the
user/database connection cache.
SRA OSS, Inc. Japan
More information about the pgpool-general