<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 14pt; color: #000000'>Would you try a test with pgbench?<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; On 06/01/2012 01:44 AM, Tatsuo Ishii wrote:<br>&gt;&gt;&gt; I am trying to load balance with pgpool (3.1.1-1) over two DB nodes<br>&gt;&gt;&gt; (PostgreSQL 9.0): 1 master &amp; 1 slave, configured for streaming replication.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; The thing is that all the queries are going to the master node. I<br>&gt;&gt;&gt; created a simple shell script in order to simulate dozens of connections<br>&gt;&gt;&gt; querying simultaneously in a loop, then disconnecting, connecting again,<br>&gt;&gt;&gt; querying, etc., but there's no query sent to the slave node at all.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; At the same time, when browsing through pgpoolAdmin, queries like<br>&gt;&gt;&gt; "SELECT pg_is_in_recovery()", and "SELECT * FROM pg_settings" are<br>&gt;&gt;&gt; arriving successfully on both places, so there's no connection issue<br>&gt;&gt;&gt; involved.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; I have even set the weight to 0 for the master:<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; backend_weight0 = 0<br>&gt;&gt;&gt; backend_weight1 = 1<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; But still, every query is sent there and not on the slave.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Any thoughts why load balancing is not working in that case?<br>&gt;&gt; For SELECT pg_is_in_recovery() itself, there's no reason not to load<br>&gt;&gt; balance. Maybe delay_threshold?<br>&gt;&gt;<br>&gt;&gt; For SELECT * FROM pg_settings, it is not load balanced since it is<br>&gt;&gt; accessing system catalog.<br>&gt; <br>&gt; In my case delay_threshold = 0, so it is disabled.<br>&gt; <br>&gt; What I meant was that those two queries appear in the PostgreSQL logs of<br>&gt; both servers - the master and the slave, which is an indication that<br>&gt; pgpool is connected to both.<br>&gt; <br>&gt; However, when issuing simple SELECT query, it appears in the log of the<br>&gt; master only. It is not load balanced. I am running the following script<br>&gt; from 20 terminals in parallel:<br>&gt; <br>&gt; #!/bin/bash<br>&gt; for a in `seq 1 10`; do<br>&gt; &nbsp; echo -n "$a: "<br>&gt; &nbsp; for usr in `psql -U postgres -d test -h localhost -p 5433 -t -c<br>&gt; "SELECT id FROM test ORDER BY RANDOM() LIMIT 10;"`<br>&gt; &nbsp; &nbsp; do<br>&gt; &nbsp; &nbsp; echo -n -e "$usr "<br>&gt; &nbsp; done<br>&gt; <br>&gt; &nbsp; sleep 1;<br>&gt; done<br>&gt; <br>&gt; <br>&gt; It makes a new connection on every loop iteration, so when running it<br>&gt; from 20 places, it is expected to do 20 * 10 = 200 connections. Still<br>&gt; everything goes to the master and nothing to the slave.<br><br>Hum. Recently we discovered that Solaris platform has problem with<br>load balance. Is this your case?<br><br>If you replace your "SELECT...;" to "SELECT 1";, still you see everything goes to master?<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>pgpool-general mailing list<br>pgpool-general@pgpool.net<br>http://www.pgpool.net/mailman/listinfo/pgpool-general<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>