<div dir="ltr">Hi Tatsuo,<br><br>    How can one create a login-account so that they can contribute to the wiki. As of now, my las name on that post is wrong, (should be Singh,not Sing). I don&#39;t see a way to create an account, and the pgpool-bugzilla account does not work there.<br>

<br>Thanks in advance,<br><br><div class="gmail_quote">On Fri, Aug 24, 2012 at 9:35 PM, Tatsuo Ishii <span dir="ltr">&lt;<a href="mailto:ishii@postgresql.org" target="_blank">ishii@postgresql.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Done.<br>
<a href="http://www.pgpool.net/mediawiki/index.php/Relationship_between_max_pool,_num_init_children,_and_max_connections" target="_blank">http://www.pgpool.net/mediawiki/index.php/Relationship_between_max_pool,_num_init_children,_and_max_connections</a><br>


<br>
Linked from document section.<br>
<div class="HOEnZb"><div class="h5"><a href="http://www.pgpool.net/mediawiki/index.php/Documentation" target="_blank">http://www.pgpool.net/mediawiki/index.php/Documentation</a><br>
--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
<br>
&gt; &quot;Relationship between max_pool, num_init_children, and max_connections&quot; ?<br>
&gt;<br>
&gt; On Thu, Aug 23, 2012 at 5:43 PM, Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; Ok. Can you please provide the document title?<br>
&gt;&gt; --<br>
&gt;&gt; Tatsuo Ishii<br>
&gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt;<br>
&gt;&gt; &gt; It doesn&#39;t sound like an FAQ item. Either a page in Wiki or in User<br>
&gt;&gt; &gt; contributed docs would be fine with me.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Wed, Aug 22, 2012 at 9:34 PM, Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; Putting into Wiki and add link in docs sounds nice idea.<br>
&gt;&gt; &gt;&gt; What about adding to FAQ?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Or do you want to place &quot;User contributed documentation&quot; section?<br>
&gt;&gt; &gt;&gt; <a href="http://www.pgpool.net/mediawiki/index.php/Documentation" target="_blank">http://www.pgpool.net/mediawiki/index.php/Documentation</a><br>
&gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; Tatsuo Ishii<br>
&gt;&gt; &gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt; Because it is quite elaborate explanation, it might not be a good fit<br>
&gt;&gt; for<br>
&gt;&gt; &gt;&gt; &gt; docs, which are supposed to be concise. Probably it should reside<br>
&gt;&gt; &gt;&gt; somewhere<br>
&gt;&gt; &gt;&gt; &gt; in wiki and the docs for max_pool should link there. But don&#39;t mind<br>
&gt;&gt; me if<br>
&gt;&gt; &gt;&gt; &gt; you think these can fit right in the docs.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; On Wed, Aug 22, 2012 at 7:06 PM, Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Great explanation. I would like to add this to somewhere in the<br>
&gt;&gt; &gt;&gt; document.<br>
&gt;&gt; &gt;&gt; &gt;&gt; Thanks!<br>
&gt;&gt; &gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; &gt;&gt; Tatsuo Ishii<br>
&gt;&gt; &gt;&gt; &gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt;&gt; &gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt;&gt; &gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Hi Hackers,<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;     I have answered max_pool related question a few times, and more<br>
&gt;&gt; &gt;&gt; than<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; once the following explanation cleared up the other party&#39;s<br>
&gt;&gt; confusion<br>
&gt;&gt; &gt;&gt; &gt;&gt; just<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; y reading it, without any more explanation from me. Do you think<br>
&gt;&gt; this<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; deserves some place on pgpool docs?<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;     max_pool parameter configures how many connections to cache<br>
&gt;&gt; _per<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; child_. So if num_init_children is configured to 100, and max_pool<br>
&gt;&gt; is<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; configured to 3, then pgpool can potentially open 300 (=3*100)<br>
&gt;&gt; &gt;&gt; &gt;&gt; connections<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; to the backend database.<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;     A child process opens a new backend connection only if the<br>
&gt;&gt; &gt;&gt; requested<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; [user,database] pair is not already in the cache. So if the<br>
&gt;&gt; &gt;&gt; application<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; uses only one user to connect to only one database, say<br>
&gt;&gt; &gt;&gt; [pguser1,pgdb1],<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; then each child will continue to reuse the first connection and<br>
&gt;&gt; will<br>
&gt;&gt; &gt;&gt; &gt;&gt; never<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; open a second connection, so in effect pgpool will open no more<br>
&gt;&gt; than<br>
&gt;&gt; &gt;&gt; 100<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; backend connections even though max_pool is set to 3.<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;     But if the application uses more than one pair of<br>
&gt;&gt; [user,database]<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; connection parameters, then each child will cache the connection it<br>
&gt;&gt; &gt;&gt; might<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; already have for another pair, and open a new backend connection<br>
&gt;&gt; for<br>
&gt;&gt; &gt;&gt; the<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; requested pair.<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;     For eg., if the application now uses these 4 pairs: [user1,db1]<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; [user1,db2] [user2,db1] [user2,db2] to connect to pgpool, then each<br>
&gt;&gt; &gt;&gt; child<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; process can cache up to 3 connections for the first 3 different<br>
&gt;&gt; pairs<br>
&gt;&gt; &gt;&gt; it<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; receives connection requests for. But as soon as it receives a<br>
&gt;&gt; request<br>
&gt;&gt; &gt;&gt; &gt;&gt; for<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; the 4th pair that it does not yet have a connection for, then it<br>
&gt;&gt; will<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; disconnect the oldest connection in the cache and open a new<br>
&gt;&gt; &gt;&gt; connection<br>
&gt;&gt; &gt;&gt; &gt;&gt; for<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; the 4th pair.<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;     As we already know that there&#39;s no guarantee as to which child<br>
&gt;&gt; &gt;&gt; &gt;&gt; process<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; will handle an incoming connection request, max_pool tries to<br>
&gt;&gt; improve<br>
&gt;&gt; &gt;&gt; the<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; performance a little bit by caching connections of different<br>
&gt;&gt; pairs, in<br>
&gt;&gt; &gt;&gt; &gt;&gt; the<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; hopes that an incoming connection request might match one of the<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; connections cached by the child process. But this also causes an<br>
&gt;&gt; &gt;&gt; &gt;&gt; explosion<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; in the number of connections that pgpool would request from the<br>
&gt;&gt; &gt;&gt; database.<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;     So, in order to guarantee that the application connection<br>
&gt;&gt; requests<br>
&gt;&gt; &gt;&gt; &gt;&gt; are<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; never rejected, and that the connection requests wait until a<br>
&gt;&gt; database<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; connection is available, the following condition should be met:<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; max_pool*num_init_children &lt;= (max_connections -<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; superuser_reserved_connections)<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;     If the application uses superuser connections (which is not<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; recommended), then the condition is reduced to:<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; max_pool*num_init_children &lt;= max_connections<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;     Setting max_pool to 1 will guarantee that the number of<br>
&gt;&gt; database<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; connections opened by pgpool child processes never exceeds the<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; num_init_children value. If for performance reasons, as explained<br>
&gt;&gt; &gt;&gt; above,<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; you do wish to set max_pool to more than 1, then max_connections<br>
&gt;&gt; will<br>
&gt;&gt; &gt;&gt; &gt;&gt; also<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; have to be increased accordingly so that application connection<br>
&gt;&gt; &gt;&gt; requests<br>
&gt;&gt; &gt;&gt; &gt;&gt; do<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; not get denied.<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Best regards,<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; --<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Gurjeet Singh<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; --<br>
&gt;&gt; &gt;&gt; &gt; Gurjeet Singh<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; Gurjeet Singh<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Gurjeet Singh<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Gurjeet Singh<br><br><a href="http://gurjeet.singh.im/" target="_blank">http://gurjeet.singh.im/</a><br></div><br>
</div>