[Pgpool-general] Question about the load balancing algorithm

Petr Janda elekktretterr at exemail.com.au
Wed Nov 5 11:30:39 UTC 2008


> pgpool selects backend in completely random manner. So I think load
> between backends will be balanced in the long term. If you want to
> load the balance in the short term, for example, if backend A loads
> *heavier* than backend B, then wants to throw a query to B, no pgpool
> is not smart enough. Howver I think the problem here is, how you could
> define backend A is *heavier* than B. Number of connections, CPU load,
> I/O load? I'm not sure.
> --

I think a simple way would be by using a timer system and pre-defined rules. 
The length of the sessions could be timed. Ie. if a query is taking a long 
time(>2s to process) to process automatically increase the weight of the node 
and once the "long session" ends return the weight to its nominal value.

This way it would pretty much guarantee that a heavy node wont be sent another 
large request if theres a lighter node available.

What do you think?

Petr Janda


More information about the Pgpool-general mailing list