[Pgpool-general] Connection pooling and amount of connections?

Tatsuo Ishii ishii at sraoss.co.jp
Thu Sep 11 01:34:29 UTC 2008


In summary, it's an expected behavior.

> Hi Chaps,
> 
> I've been trying pgpool II, and doing a few tests. At the moment I have init_children set to 500 and max pool set to 1.
> 
> I've got 5 processes running that connect to 2 databases on the target server, and they constantly connect, fetch some data for about 30 seconds and then disconnect then connect again in a loop.
> 
> Pgpool has 10 connections as expected, however the postgres server has over 200 connections from pgpool and that number is growing fast.

pgpool forks 500 child processes which are all ready to accpet a
connection from clients if they are not busy ("busy" means it has
an established connection from client). Which child accept is
determined by kernel and it's neccesary true that a child which is not
busy *and* has a connection cache. So in the worst scenario, even if
you have only one client, number of connections from pgpool to
PostgreSQL might grow up to num_init_children.

> I guess I've missed something here - I thought the connections would be reused out of the 10 seeing as there's only the 5 clients?

You may want to lower num_init_children to 5 in this case.

> Out of the 200 connections, if I try to connect in as a different user will the one of the old connections be used? If not; whats the point?

Only if your kernel chooses the child which has the existing
connection cache.
--
Tatsuo Ishii
SRA OSS, Inc. Japan


More information about the Pgpool-general mailing list