<div dir="ltr"><div>Hi <span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">Jianshen,</span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><br></span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">I think it is a very good idea to have on-demand spawning of the</span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">child processes and it will enable us to </span><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">effectively configure the</span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">Pgpool-II in environments where we get </span>instantaneous<span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"> connection spikes.</span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">Currently </span><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">we have to configure the Pgpool&#39;s num_init_children to a</span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">value of &quot;</span><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">maximum number of connections expected&quot; </span><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">and most of the</span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">time, 50 to 60 percent of child processes keep sitting idle and</span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">consuming system resources.</span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><br></span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">Similarly, I also agree with having an option of the global connection</span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">pool and I believe that will enable us </span><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">to have less number of opened backend</span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">connections and also in the future we can build a different type of pooling</span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">options on that like transaction pooling and similar features.</span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><br></span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">IMHO we should take both of these features as a separate project. </span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">We can start with </span><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">on-demand child spawning feature and once we have</span></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">that in Pgpool-II we build the global connection </span><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">pool option on top of that.</span></div><div><br></div><div><font color="#282828" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:16px">So if you are interested in working on that, you can send the proposal and</span></font></div><div><font color="#282828" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:16px">include the details like </span></font><span style="font-size:16px;color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif">how are you planning to manage the child-process-pool</span></div><div><span style="font-size:16px;color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif">and when will the Pgpool-II spawn and destroy the </span><span style="font-size:16px;color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif">child processes?</span></div><div><span style="font-size:16px;color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif">My idea would be to make child-process-pool as much configurable as possible.</span></div><div><font color="#282828" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:16px">Some of the configuration parameters I can think of for the purpose are.</span></font></div><div><font color="#282828" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:16px"></span></font></div><div><font color="#282828" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:16px"><br></span></font></div><div><font color="#282828" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:16px">CPP_batch_size                                     /* number of child process we will spawn when required */</span></font></div><div><font color="#282828" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:16px"><br></span></font></div><div><div><font color="#282828" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:16px">CPP_downscale_trigger                          /* number of idle child process in Pgpool-II to start</span></font></div><div><font color="#282828" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:16px">                                                                * killing the idle child process */</span></font></div><div><font color="#282828" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:16px"><br></span></font></div><div></div></div><div><div><font color="#282828" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:16px">CPP_upscale_trigger                             /* number of idle child process in Pgpool-II to start</span></font></div><div></div></div><div><div><font color="#282828" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:16px">                                                                * spawning new child process */</span></font></div><div></div></div><div><br></div><div><font face="tahoma, sans-serif">CPP here stands for CHILD-PROCESS-POOL and these are just my thoughts and you may want to choose<br></font></div><div><font face="tahoma, sans-serif">different names and/or different types of configurations altogether.</font></div><div><br></div><div>Looking forward to getting an actual proposal.</div><div><br></div><div>Thanks</div><div>Best regards<br>Muhammad Usama</div><div><br></div><div><span style="color:rgb(40,40,40);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><br></span></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 13, 2020 at 2:56 PM 周建身 &lt;<a href="mailto:zhoujianshen@highgo.com">zhoujianshen@highgo.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div>
<div style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif">
<p><span style="color:rgb(40,40,40);font-family:&quot;microsoft yahei ui&quot;,&quot;microsoft yahei&quot;,微软雅黑,simsun,宋体,sans-serif;font-size:15px;background-color:rgb(255,255,255)">Hello Usama and Hackers,</span></p>
<p><span>    </span>I have tested the pgpool connection pool.And I think there are some parts need to be enhanced.</p>
<p><span>    </span>When you set the parameter num_init_children = 32.only 32 child processes will be forked and waiting for the connection from client.<span style="font-size:12pt">E</span><span style="font-size:12pt">ach child process can only receive
 one client connection,t</span><span style="font-size:12pt">herefore, only 32 clie</span><span style="font-size:12pt">n</span><span style="font-size:12pt">ts can connect to pgpool at the same time.The extra connections,before connection, can only wait
 for the previous connection to be disconnected.So,can we change the waiting connection structure of pgpool. When pgpool starts ,we can fork ten child processes to wait for the client to connect.When the child process receives the connection request, it creates
 a new child process to maintain the session connection.</span></p>
<p><span style="font-size:12pt"><span>    </span>there is also another one which should be enhance is the connection pool.</span><span style="font-size:12pt">Now, for each connection, the child process can only receive one client connection. Therefore,
 the connection pool in the child process does not play a global reuse </span><span style="font-size:12pt">effect.And each connection will re-initialize the connection pool. Therefore we should implement a global connection pool to achieve the effect of back end reuse.However
 ,we should confirm how many connections the global connection pool should maintain.And also we should confirm that if the connection pool is full,how should we respond to the arrival of new connections</span><span style="font-size:12pt">.I can come up with
 two kind of solutions.</span></p>
<p><span style="font-size:12pt"><span>    </span>The first one is waiting until the connection in the connection pool disconnected.and then receive the new connection.The second one,We should check the number of connection and  the last access time of the connection
 in connection pool.And we replace the connection which has the oldest access time in the connection pool to the new connection.or we periodic detection the access time of each connection,and throw away the connections whose access time exceed a certain value.then
 we can use the extra space in connection pool.</span></p>
<p><span style="font-size:12pt">    In my </span>opinion<span style="font-size:12pt">,these two aspects need to be enhanced.How about your opinion.And what do you think we need to do to enhance these two aspects.Any suggestions and comments are welcome.</span><br>
</p>
<p><span style="font-size:12pt"><br>
</span></p>
<p><span style="font-size:12pt"><br>
</span></p>
<div style="color:rgb(40,40,40);font-family:calibri,arial,helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255);margin-top:0px;margin-bottom:0px">
<font face="Calibri,Arial,Helvetica,sans-serif"><font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif" size="1"><span style="font-size:13.32px">Thanks</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif" size="1"><span style="font-size:13.32px">Best regards</span></font><br>
Zhou Jianshen</font></div>
<div style="color:rgb(40,40,40);font-family:calibri,arial,helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255);margin-top:0px;margin-bottom:0px">
<font face="Calibri,Arial,Helvetica,sans-serif"><a href="mailto:zhoujianshen@highgo.com" target="_blank"><font face="verdana" size="1"><span style="font-size:13.32px">zhoujianshen@highgo.com</span></font></a><font face="verdana" size="1"><span style="font-size:13.32px"></span></font></font></div>
<p><span style="font-size:12pt"><br>
</span></p>
<p><br>
<br>
</p>
<p><br>
</p>
</div>
</div>

_______________________________________________<br>
pgpool-hackers mailing list<br>
<a href="mailto:pgpool-hackers@pgpool.net" target="_blank">pgpool-hackers@pgpool.net</a><br>
<a href="http://www.pgpool.net/mailman/listinfo/pgpool-hackers" rel="noreferrer" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-hackers</a><br>
</blockquote></div></div>