[Pgpool-general] Question about the load balancing algorithm

Tatsuo Ishii ishii at sraoss.co.jp
Mon Nov 3 09:31:35 UTC 2008


> Hi and thanks for what seems to be great software.
> 
> I have a couple of questions about pgpool-II's load balancing algorithm.
> 
> Lets say Im running in replication + load balancing mode and I have 2 nodes, 
> both have the same weights configured in pgpool.conf and a large SELECT query 
> that returns hundreds of thousands of rows of data is executed on node 1. 
> There are a few small queries being executed on node 2 at the same time.
> 
> Now what if there is another large SELECT query? is the algorithm smart enough 
> to find out that the previous large SELECT is still being executed on Node 1 
> and appropriately the second query is directed to Node 2 or the node 
> selection is only based on the statically defined weights?

First of all pgpool-II decides which node should be chosen at the
session level, not statement level.

pgpool-II is not smart enough to remeber which node is executing a
large SELECT. However a pgpool process which is handling large SELECT
is not likely to become idle soon, and next session will be likely
thrown to the node which executes light SELECT since it has more
chance to release the connection to the client.

So I think in the long term the load for each backend will be
balanced.
--
Tatsuo Ishii
SRA OSS, Inc. Japan


More information about the Pgpool-general mailing list