[pgpool-general: 5431] Re: connection pooling not working

Tatsuo Ishii ishii at sraoss.co.jp
Fri Apr 21 09:44:43 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.

BTW, you can check how many times a connection cache is resued by
using pcp_proc_info command:

http://www.pgpool.net/docs/latest/en/html/pcp-proc-info.html

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp


More information about the pgpool-general mailing list