[pgpool-general: 398] Re: strange load balancing issue in Solaris

Tatsuo Ishii ishii at postgresql.org
Tue May 1 08:11:11 JST 2012

First of all please check "normalized" weights are as you expected.
Run "show pool_status;" and see "backend_weight0", "backend_weight1"
section. You see a floating point numbers, which are the normalized
weight between 0.0 and 1.0. If you see both are 0.5, primary and
standby are given same weight.

If they are ok, I suspect srandom() function behavior is different
from other platforms. Pgpool-II chooses the load balance node by using
srandom(). select_load_balancing_node() is the function which is
responsible for selecting the load balance node. If you run pgpool-II
with -d (debug) option, you will see following in the log:

	pool_debug("select_load_balancing_node: selected backend id is %d", selected_slot);

If backend_weight in show pool_status are fine but the line above
always shows same number, it is the sign that we have problem with
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp

> Hi All,
> I am facing a strange issue in load balancing with replication mode set to
> true in Solaris. Load balancing algorithm always select the same node
> whatever may be the backend weight
> Here is the scenario.
> I have a pgpool installed installed in 1 server
> 2 postgres nodes in other 2 servers
> replication mode set to true and load balancing set to true
> backend weight of the 2 nodes is 1.
> When I fire the queries manuall using different connections or using
> pgbench all the queries hit the same node. Load balancing algorithm always
> select the same node.
> No effect in changing the backend weight. Only when I set backend weight to
> 0 hits go to the other server.
> I face this issue only in solaris. The same setup in other servers ( centos
> ,RHEL, ubunt etc) does the load balancing perfectly.
> Also tries various postgres versions and pgpool version with same result.
> But every version runs fine in other servers.
> Has anyone faced this issue?
> Any information would highly helpful.
> Regards,
> Aravinth

More information about the pgpool-general mailing list