ResourcePool::LoadBalancer is a load balancer across ResourcePool's.
SYNOPSIS
use ResourcePool::LoadBalancer;
my $loadbalancer = ResourcePool::LoadBalancer->new("key", MaxTry => 10);
$loadbalancer->add_pool($some_ResourcePool);
$loadbalancer->add_pool($some_other_ResourcePool);
$loadbalancer->add_pool($third_ResourcePool);
my $resource = $loadbalancer->get(); # get a resource from one pool
# according to the policy
#[...] # do something with $resource
$loadbalancer->free($resource); # give it back to the pool
$loadbalancer->fail($resource); # give back a failed resource
The ResourcePool::LoadBalancer is a generic way to spread requests to different ResourcePool's to increase performance and/or availability.
Besides the construction the interface of ResourcePool::LoadBalancer is the same as the interface of ResourcePool. This makes it very simple to change a program which uses ResourcePool to use the ResourcePool::LoadBalancer by just changing the construction (which is hopefully kept at a central point in your program).
Product's homepage
Requirements:
· Perl