[pgpool-general: 206] Re: Another question about num_init_children and max_pool

Tatsuo Ishii ishii at postgresql.org
Sun Feb 5 09:12:17 JST 2012

> I use a pgpool-II v3.0.5 compiled and installed by my self on a Debian
> Squeeze.
> I only use pgpool-II as a loadbalancer between 2 database nodes which
> stay synchronized via an Hot Standby replication.
> In my pgpool-II configuration one of this node has a really high
> weight than the other (1000 against 1) to be the prior node to answer.
> Everything works well but I have a question about the pool of
> connections.
> In my pgpool-II configuration I have the following settings:
> ...
> num_init_children = 19
> max_pool = 4
> ...
> I set it like that because I believed there would be a maximum of 4x19
> = 76 potential connections.
> During a test I launched a lot of long queries... and I noted there
> were only 19 connections at the same time and I have to wait for the
> end of a previous queries to launch the next one...
> All my connections came from the same host and used the same database
> and user.
> I also read in a previous mail on this mailing list
> (http://www.mail-archive.com/pgpool-general@pgfoundry.org/msg03334.html)
> it's normal it's only 19 active connections at a time.
> But I don't really understand how I can reach 76 connections if I only
> have 19 active at one time? And in this case, is the pool really
> useful? I just would like there will be a maximum of 76 connections at
> a time.
> According to another mail
> (http://www.sraoss.jp/pipermail/pgpool-general/2011-December/000070.html)
> I will be tempted by setting up my pgpool-II as following:
> ...
> num_init_children = 76
> max_pool = 1
> ...

num_init_children is max concurrent *active* connections to
PostgreSQL. So, yes, you see only 19 connections is quite normal. The
possibility of exceeding 19 is, you connect to pgpool with different
user, database combination. Suppose you want to use different
databasae A and B, you will have 19*2 = 38 connections at
max. However, the max *active* connection to PostgreSQL is still
19. Rest of 19 is idle and are waiting for becoming active.

So if you are sure that you have only 1 user, database combo, 

> num_init_children = 76
> max_pool = 1

this setting makes sense.
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