[pgpool-general: 6488] Re: Load balancer: how does it work

Tatsuo Ishii ishii at sraoss.co.jp
Tue Apr 2 16:13:42 JST 2019


> Good morning,
> 
> Could you explain to me how load balancing process in Pgpool works "in the
> background", as I am not sure I understood it correctly? Are there some
> algorithms that are selected? Can we set rules to define for example "Okay,
> SELECT name, npa FROM City will go to this node and SELECT firstname,
> lastname FROM Customers will go to that other node"?

The target node to be sent read queries (load balance node) is decided
at the time when session starts. The way to determine a load balance
node is based on random number weighted by "backend_weightN"
parameters. For example, the backend_weight parameters are equal, node
0 or node 1 will chosen equally in a long term. You may observe that
node 0 (or node 1) is continuously chosen in a short term, but
eventually the ratio should be getting closer 1:1.

Note that upcoming Pgpool-II 4.1 will have a feature "statement level
load balancing" which determines the load balance node at a query
starts, rather than a session starts.

I have just written a blog about this.

http://pgsqlpgpool.blogspot.com/2019/04/statement-level-load-balancing.html

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp


More information about the pgpool-general mailing list