<div dir="rtl"><div dir="rtl"><div dir="ltr">-well it depends on how many arguments are sent. I checked the diff by looking on pg_stat_statements. Before every test I reset all the content of it. I attach an excel file(csv format) with the diffs.</div><div dir="ltr"><div dir="ltr">-pgpool-II version 3.7.7 (amefuriboshi)</div><div>-Indeed, java app.  </div><div>-I had 16cpus.</div><div>-The size of 1 row is about 16KB.</div></div><div dir="ltr"><br></div></div></div><br><div class="gmail_quote"><div dir="rtl">‫בתאריך יום ג׳, 25 בדצמ׳ 2018 ב-10:42 מאת ‪Tatsuo Ishii‬‏ &lt;‪<a href="mailto:ishii@sraoss.co.jp">ishii@sraoss.co.jp</a>‬‏&gt;:‬<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">How many rows do these SELECTs return? Also how wide are each row?<br>
These will affect performance of Pgpool-II because the bigger they<br>
are, the more network packets are neccessary.<br>
<br>
Also please share Pgpool-II version, using extended query or not (if<br>
the app is Java application, it&#39;s yes), and how many (virtual) cpus<br>
are there.<br>
<br>
Best regards,<br>
--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
<br>
&gt; Well, it is a little bit complicated to explain. Basicly, I monitored all<br>
&gt; the queries that are running and I saw that the huge diff in performance is<br>
&gt; generated because of the next query :<br>
&gt;  select columns from table_name<br>
&gt; where col1 in(..)<br>
&gt; and (col2 in (...) or col3 in (...))<br>
&gt; and col4in (...)<br>
&gt; <br>
&gt; We run this query a lot of times and the diff between performance is about<br>
&gt; 70% in most of the times.<br>
&gt; <br>
&gt; ‫בתאריך יום ג׳, 25 בדצמ׳ 2018 ב-8:35 מאת ‪Tatsuo Ishii‬‏ &lt;‪<br>
&gt; <a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>‬‏&gt;:‬<br>
&gt; <br>
&gt;&gt; BTW, x4.5 slowness sounds unusual. What is your application doing?<br>
&gt;&gt;<br>
&gt;&gt; Best regards,<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" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt;<br>
&gt;&gt; &gt; 40% loss is for typical light weight query case. For heavier query,<br>
&gt;&gt; &gt; for example something like, SELECT count(*) FROM really_big_table,<br>
&gt;&gt; &gt; performance loss will be pretty subtle.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; But if you want really low performance loss (for example less than<br>
&gt;&gt; &gt; 10%) in any query, probably you&#39;d better to look for another<br>
&gt;&gt; &gt; solutions.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Best regards,<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; Tatsuo Ishii<br>
&gt;&gt; &gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt; English: <a href="http://www.sraoss.co.jp/index_en.php" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt; Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; The load average was pretty normal in both cases so I dont think that<br>
&gt;&gt; &gt;&gt; limited resources are the root cause here. 40% performance loss is<br>
&gt;&gt; pretty<br>
&gt;&gt; &gt;&gt; big number, isnt there a way to debug it ?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; ‫בתאריך יום א׳, 23 בדצמ׳ 2018 ב-13:49 מאת ‪Tatsuo Ishii‬‏ &lt;‪<br>
&gt;&gt; &gt;&gt; <a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>‬‏&gt;:‬<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; Hi,<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; Pgpool-II needs to store and forward each network packet from clients<br>
&gt;&gt; &gt;&gt;&gt; and PostgreSQL.  So usually about 40% performance loss is expected<br>
&gt;&gt; &gt;&gt;&gt; comparing with direct connecting to PostgreSQL.  That says, if your<br>
&gt;&gt; &gt;&gt;&gt; application&#39;s SELECT reads a lot of rows for example, it may take more<br>
&gt;&gt; &gt;&gt;&gt; time.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; Another point of consideration is, hardware resources especially CPU,<br>
&gt;&gt; &gt;&gt;&gt; memory and network. In your test case #1, on node A only applications<br>
&gt;&gt; &gt;&gt;&gt; and walreciver use CPU, On the other hand in test case #2, on node A<br>
&gt;&gt; &gt;&gt;&gt; the applications, Pgpool-II and walreciver use CPU. So it maybe<br>
&gt;&gt; &gt;&gt;&gt; possible Pgpool-II cannot get enough CPU. Have you checked resource<br>
&gt;&gt; &gt;&gt;&gt; usage?<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; Best regards,<br>
&gt;&gt; &gt;&gt;&gt; --<br>
&gt;&gt; &gt;&gt;&gt; Tatsuo Ishii<br>
&gt;&gt; &gt;&gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt;&gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt;&gt;&gt; Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt; I meant that max_connection is set to 500. I did the same text with<br>
&gt;&gt; &gt;&gt;&gt; &gt; num_init_children=500 but same performance(because my app doesnt use<br>
&gt;&gt; in<br>
&gt;&gt; &gt;&gt;&gt; &gt; this architecture more then 200 connections..).<br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt; ‫בתאריך יום א׳, 23 בדצמ׳ 2018 ב-10:29 מאת ‪Pierre Timmermans‬‏ &lt;‪<br>
&gt;&gt; &gt;&gt;&gt; &gt; <a href="mailto:ptim007@yahoo.com" target="_blank">ptim007@yahoo.com</a>‬‏&gt;:‬<br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; What do you mean by &quot;My db has 500 max connections&quot; ? If you have<br>
&gt;&gt; 500<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; concurrent connections, then you should set num_init_children to<br>
&gt;&gt; 500,<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; because now you can have no more than 200 concurrent users (with<br>
&gt;&gt; pgpool<br>
&gt;&gt; &gt;&gt;&gt; a<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; connection is released from the pgpool only if it the session<br>
&gt;&gt; &gt;&gt;&gt; disconnects<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; from postgres)<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; Pierre<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; On Sunday, December 23, 2018, 9:26:17 AM GMT+1, Mariel Cherkassky &lt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; <a href="mailto:mariel.cherkassky@gmail.com" target="_blank">mariel.cherkassky@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; Hi,<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; I&#39;m using pgpool and I&#39;m suffering from very poor performance issues<br>
&gt;&gt; &gt;&gt;&gt; when<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; using the pool. I have the next architecture  :<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; 1)Node A, contains the application,standby database and pgpool<br>
&gt;&gt; service.<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; 2)Node B contains the primary db and pgpool service that will be<br>
&gt;&gt; used<br>
&gt;&gt; &gt;&gt;&gt; only<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; in failover.<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; I did the next 2 tests :<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; -In the first test, the application on node A access the DB on node<br>
&gt;&gt; B<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; directly, without connecting to the pool. I run one of our<br>
&gt;&gt; application`s<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; major procedures and it took 40s.<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; -In the second test, the application on node A access the pool on<br>
&gt;&gt; node A<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; and it redirects the queries to node B. I run the same procedure<br>
&gt;&gt; and it<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; took 3minutes.<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; My db has 500 max connections and the application has only 1 user<br>
&gt;&gt; and 1<br>
&gt;&gt; &gt;&gt;&gt; db<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; so I set the num_init_children to be 200 and pool_size to be 1.<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; Any idea how can I tune the pgpool ?<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; Thanks.<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; _______________________________________________<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; pgpool-general mailing list<br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; <a href="mailto:pgpool-general@pgpool.net" target="_blank">pgpool-general@pgpool.net</a><br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt; <a href="http://www.pgpool.net/mailman/listinfo/pgpool-general" rel="noreferrer" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-general</a><br>
&gt;&gt; &gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; pgpool-general mailing list<br>
&gt;&gt; &gt; <a href="mailto:pgpool-general@pgpool.net" target="_blank">pgpool-general@pgpool.net</a><br>
&gt;&gt; &gt; <a href="http://www.pgpool.net/mailman/listinfo/pgpool-general" rel="noreferrer" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-general</a><br>
&gt;&gt;<br>
</blockquote></div>