<p dir="ltr">Hi Roman</p>
<p dir="ltr">we&#39;ve recently experienced similar problems to which you&#39;re referring. It was the case, when the machine with pgpool had larger network latencies to the postgres server (~30ms rtt, pgpool and db were in different datacenters).<br>
I&#39;ve enabled logging all queries on the database, while debugging the issue and discovered that the slowdown was caused by queries like &quot;set session characteristics read-only/read-write&quot; or &quot;set transaction level isolation&quot;, which was done for every query. There were several more type of such queries, but the bottom line is, it was done for every query sent to the database prior executing the query itself. When the pgpool is on the same network, the penalty is negligible, but when the latencies get in the way, it causes problems.</p>
<p dir="ltr">Don&#39;t know whether your problem is the same, but maybe it can help you trace the issue.</p>
<p dir="ltr">Cheers.<br>
Petr</p>
<div class="gmail_quote">On Apr 3, 2016 14:13, &quot;Roman D&quot; &lt;<a href="mailto:dostick@gmail.com">dostick@gmail.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thank you for the response.<br>
Performance measured by running load tests on web application simulating hundreds of simultaneous users and requests.<br>
“Round trip” meaning time from start of SQL request until response received.<br>
<br>
Are there any insights/advice about connecting to pgpool-II on application level? It seems like it’s not advisable to use connection pool in front of pgpool-II?<br>
We have Java application that uses c3p0 connection pool. Comparing direct connection java-&gt; postgres with java -&gt; pgpool-II -&gt; postgres makes Java application slower by 6-8 times, most time spent in connection pool code. In all places there is large number of available connections, more than needed.<br>
<br>
Thanks.<br>
<br>
&gt; On 3 Apr 2016, at 6:20 PM, Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt; wrote:<br>
&gt;<br>
&gt; Strange. I have never tried with RDS but I have tried pgpool-II with<br>
&gt; PostgreSQL on EC2 instances and have not seen such a performance<br>
&gt; degradation. How do you measure performance? pgbench?<br>
&gt;<br>
&gt; The term &quot;round trip&quot; is not very clear for me...<br>
&gt;<br>
&gt; Best regards,<br>
&gt; --<br>
&gt; Tatsuo Ishii<br>
&gt; SRA OSS, Inc. Japan<br>
&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; Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;<br>
&gt;&gt; Hello,<br>
&gt;&gt;<br>
&gt;&gt; Amazon RDS Master and Read replica.<br>
&gt;&gt; The goal is to have Read queries balanced to Read Replica using pgpool, while Replication is provided by RDS.<br>
&gt;&gt; I thought that my case is pretty common, but there’s no mention anywhere on the net or in this list of someone ever done this.<br>
&gt;&gt;<br>
&gt;&gt; But surprisingly this configuration works!<br>
&gt;&gt; Using combination of these parameters:<br>
&gt;&gt; replication_mode = off<br>
&gt;&gt; load_balance_mode = on<br>
&gt;&gt; master_slave_mode = on<br>
&gt;&gt; master_slave_sub_mode = ‘stream&#39;<br>
&gt;&gt;<br>
&gt;&gt; pgpool 3.3.4<br>
&gt;&gt; Master configured in pgpool.paswd as 0 and replica as 1<br>
&gt;&gt;<br>
&gt;&gt; Here’s the conf:<br>
&gt;&gt;<br>
&gt;&gt; backend_hostname0 = ‘master’<br>
&gt;&gt; backend_port0 = 5432<br>
&gt;&gt; backend_weight0 = 1<br>
&gt;&gt; backend_flag0 = ‘DISALLOW_TO_FAILOVER’<br>
&gt;&gt;<br>
&gt;&gt; backend_hostname1 = ’slave’<br>
&gt;&gt; backend_port1 = 5432<br>
&gt;&gt; backend_weight1 = 1<br>
&gt;&gt; backend_flag1 = ‘DISALLOW_TO_FAILOVER&#39;<br>
&gt;&gt;<br>
&gt;&gt; enable_pool_hba = on<br>
&gt;&gt; pool_passwd = ‘pool_passwd&#39;<br>
&gt;&gt; ssl = off<br>
&gt;&gt;<br>
&gt;&gt; num_init_children = 200<br>
&gt;&gt; max_pool = 4<br>
&gt;&gt; child_life_time = 300<br>
&gt;&gt; child_max_connections = 2000<br>
&gt;&gt; connection_life_time = 300<br>
&gt;&gt; client_idle_limit = 0<br>
&gt;&gt; listen_backlog_multiplier = 5<br>
&gt;&gt;<br>
&gt;&gt; connection_cache = on<br>
&gt;&gt; reset_query_list = ‘ABORT; DISCARD ALL&#39;<br>
&gt;&gt;<br>
&gt;&gt; replication_mode = off<br>
&gt;&gt; load_balance_mode = on<br>
&gt;&gt; master_slave_mode = on<br>
&gt;&gt; master_slave_sub_mode = &#39;stream&#39;<br>
&gt;&gt; sr_check_period = 0<br>
&gt;&gt;<br>
&gt;&gt; parallel_mode = off<br>
&gt;&gt; health_check_period = 0<br>
&gt;&gt; use_watchdog = off<br>
&gt;&gt; memory_cache_enabled = off<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; The problem is that pgpool is up to 4 times slower then direct connection to database.<br>
&gt;&gt; Without pgpool database roundtrip is 10 msec. With pgpool it’s 30-40 msec.<br>
&gt;&gt;<br>
&gt;&gt; pgpool is hosted on separate machine form the application and database. PGPool machine CPU is at 5% ( net.core.somaxconn set to 5000)<br>
&gt;&gt; application CPU/memory is at 50% and database CPU&amp;memory is at 50% load<br>
&gt;&gt; so basically pgpool is being the bottleneck, doing something that slows down the database access.<br>
&gt;&gt;<br>
&gt;&gt; I tried changing every possible parameter, changing num_init_children, max_pool - that does not improve anything.<br>
&gt;&gt;<br>
&gt;&gt; I am about to give up. Please help! Is there anything else I can look into ?It would be amazing if this worked without adding such significant time overhead.<br>
&gt;&gt;<br>
&gt;&gt; Thank you!<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; pgpool-general mailing list<br>
&gt;&gt; <a href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a><br>
&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>
<br>
_______________________________________________<br>
pgpool-general mailing list<br>
<a href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a><br>
<a href="http://www.pgpool.net/mailman/listinfo/pgpool-general" rel="noreferrer" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-general</a><br>
</blockquote></div>