<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 14pt; color: #000000'>What are the reasons for analysing system catalogs on primary server?<br><br>Regards.<br><br><hr id="zwchr"><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">&gt; Tatsuo, when pgpool needs to send query to system catalogs on primary to analyze user queries? <br><br>Yes.<br><br>&gt; What is the relation of this behavior with the configuration parameter relcache_expire? <br><br>relcache_expire control the life time of the cache(relcache) for those<br>queries above. Note that relcache's life time is per session.<br>--<br>Tatsuo Ishii<br>SRA OSS, Inc. Japan<br>English: http://www.sraoss.co.jp/index_en.php<br>Japanese: http://www.sraoss.co.jp<br><br>&gt; Regards. <br>&gt; <br>&gt; ----- Mensaje original -----<br>&gt; <br>&gt;&gt; &gt; On Mon, May 21, 2012 at 6:13 PM, Lonni J Friedman<br>&gt;&gt; &gt; &lt;netllama@gmail.com&gt; wrote:<br>&gt;&gt; &gt;&gt; On Mon, May 21, 2012 at 5:24 PM, Tatsuo Ishii<br>&gt;&gt; &gt;&gt; &lt;ishii@postgresql.org&gt; wrote:<br>&gt;&gt; &gt;&gt;&gt;&gt; On Mon, May 21, 2012 at 3:57 PM, Tatsuo Ishii<br>&gt;&gt; &gt;&gt;&gt;&gt; &lt;ishii@postgresql.org&gt; wrote:<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; Greetings,<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; I'm running pgpool-II-3.1.2 purely for load balancing in front<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; of a 4<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; node postgresql-9.1.3 cluster (all running on Linux-x86_64).<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; I'm<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; using streaming replication with 3 hot standby servers. I have<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; the<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; weighting distributed such that the master weight is set to<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; '1' and<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; the three standby servers are set to '33' each. My intent was<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; that<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; this would nearly eliminate all read queries going to the<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; master,<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; however what I'm observing is that the overall performance<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; seems to be<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; bottlenecked by the performance of the master, even when<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; queries<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; aren't ultimately getting sent to the master.<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; For example, there are times when the load on the master is<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; much<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; higher than on the standby servers, and the master's overall<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; performance is noticeably degraded. When this occurs, I've<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; found that<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; establishing a database connection through pgpool with a SQL<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; query<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; that should normally go to one of the standby servers has very<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; poor<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; performance. It seems like pgpool is silently doing something<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; with<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; the master (which is under load and slower to respond), before<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; passing<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; the query itself off to a standby server.<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt; Is this expected behavior?<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; Yes. Pgpool needs to send query to system catalogs on primary<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; to<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; analyze user queries (for example, if the refereed table is a<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; temporary table or not).<br>&gt;&gt; &gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt; Thanks, that's good to know, but also disappointing. This<br>&gt;&gt; &gt;&gt;&gt;&gt; behavior is<br>&gt;&gt; &gt;&gt;&gt;&gt; serving as a huge bottleneck in my environment. It basically<br>&gt;&gt; &gt;&gt;&gt;&gt; means<br>&gt;&gt; &gt;&gt;&gt;&gt; that no standby server can respond any faster than the master,<br>&gt;&gt; &gt;&gt;&gt;&gt; which<br>&gt;&gt; &gt;&gt;&gt;&gt; defeats much of the benefit of load balancing.<br>&gt;&gt; &gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt; Is there any way to work around this, or mitigate it to some<br>&gt;&gt; &gt;&gt;&gt;&gt; degree?<br>&gt;&gt; &gt;&gt;&gt;&gt; For example, I'm not using temp tables for anything in my<br>&gt;&gt; &gt;&gt;&gt;&gt; environment,<br>&gt;&gt; &gt;&gt;&gt;&gt; so not performing that check wouldn't have any impact on me.<br>&gt;&gt; &gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt; I thought the access to system catalogs are not big pain because<br>&gt;&gt; &gt;&gt;&gt; pgpool has session life time caches for this. However it seems<br>&gt;&gt; &gt;&gt;&gt; they<br>&gt;&gt; &gt;&gt;&gt; might be bottle neck in your case. I would like to know what kind<br>&gt;&gt; &gt;&gt;&gt; of<br>&gt;&gt; &gt;&gt;&gt; quries are major bottle neck in your case. Could you show me the<br>&gt;&gt; &gt;&gt;&gt; query<br>&gt;&gt; &gt;&gt;&gt; log on the primary?<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; I don't have a query log, as we're not logging queries. I guess I<br>&gt;&gt; &gt;&gt; could enable query logging in pgpool if you think that's going to<br>&gt;&gt; &gt;&gt; help<br>&gt;&gt; &gt;&gt; you investigate this further, but I'm concerned that's going to<br>&gt;&gt; &gt;&gt; create<br>&gt;&gt; &gt;&gt; significant disk activity on the pgpool server.<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; But the issue isn't that specific queries are a bottleneck but<br>&gt;&gt; &gt;&gt; rather<br>&gt;&gt; &gt;&gt; that if there's a large amount of write activity, the load on the<br>&gt;&gt; &gt;&gt; master will be much greater than on the standby/slaves, thereby<br>&gt;&gt; &gt;&gt; reducing the performance of both the master &amp; the standby/slaves.<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; Does the lack of reply mean that I'm basically out of luck on this?<br>&gt;&gt; &gt; Personally, I see this behavior as a significant flaw in pgpool's<br>&gt;&gt; &gt; design. Its not true load balancing if every query is gated by the<br>&gt;&gt; &gt; performance of 1 server.<br>&gt; <br>&gt;&gt; Any idea how to solve this?<br>&gt;&gt; --<br>&gt;&gt; Tatsuo Ishii<br>&gt;&gt; SRA OSS, Inc. Japan<br>&gt;&gt; English: http://www.sraoss.co.jp/index_en.php<br>&gt;&gt; Japanese: http://www.sraoss.co.jp<br>&gt;&gt; _______________________________________________<br>&gt;&gt; pgpool-general mailing list<br>&gt;&gt; pgpool-general@pgpool.net<br>&gt;&gt; http://www.pgpool.net/mailman/listinfo/pgpool-general<br>&gt; <br>&gt;&gt; 10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS<br>&gt;&gt; INFORMATICAS...<br>&gt;&gt; CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION<br>&gt; <br>&gt;&gt; http://www.uci.cu<br>&gt;&gt; http://www.facebook.com/universidad.uci<br>&gt;&gt; http://www.flickr.com/photos/universidad_uci<br>&gt; <br>&gt; <br>&gt; 10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...<br>&gt; CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION<br>&gt; <br>&gt; http://www.uci.cu<br>&gt; http://www.facebook.com/universidad.uci<br>&gt; http://www.flickr.com/photos/universidad_uci<br><br>10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...<br>CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION<br><br>http://www.uci.cu<br>http://www.facebook.com/universidad.uci<br>http://www.flickr.com/photos/universidad_uci<br></blockquote><br></div>
<br><html>
<body>
<a href="http://www.uci.cu/">
<img src="http://universidad.uci.cu/email.gif"/>
</body>
</html>

<br></body></html>