NAME
ResourcePool::BigPicture - ResourcePool introduction
DESCRIPTION
The ResourcePool package consists of two major parts:
ResourcePool
LoadBalancer
ResourcePool
The ResourcePool is used to manage a pool of persistent connections (or more generally "resources"). Every resource in a pool is exactly equivalent to the others since all of them are created through the same factory.
If you want to make a pool of different resources (e.g. connections to different databases) you have to use the ResourcePool::LoadBalancer.
The ResourcePool uses two other classes to operate:
- ResourcePool::Factory
-
used to create resources
- ResourcePool::Resource
-
used as wrapper to implement a unique interface to all resources
To create a ResourcePool you need a ResourcePool::Factory which is able to create the ResourcePool::Resource's you want to use. The ResourcePool will then use this factory to create ResourcePool::Resource objects as required.
The ResourcePool::Resource itself creates the finally interesting objects like DBI or Net::LDAP and provides a standard way to perform the common operations required by ResourcePool to work with this resource.
The ResourcePool::Factory and ResourcePool::Resource classes are base classes to inherit the specialized classes for your resource from. The classes to handle DBI and Net::LDAP resources are included in the distribution.
After creating a ResourcePool you can use the get() method to obtain a resource. The get() method will return the DBI or Net::LDAP object which can be used as usually. Afterwards you have to hand the resource back into the pool by calling the free() method.
Please have a look to the ResourcePool documentation for further details.
ResourcePool::LoadBalancer
A ResourcePool::LoadBalancer can be used to configure a failover and/or loadbalancing behavior for ResourcePool users.
To construct a ResourcePool::LoadBalancer you need one or more ResourcePools. After construction a ResourcePool::LoadBalancer behaves like a ResourcePool, so you can call the get() method to obtain a resource.
The ResourcePool::LoadBalancer can be configured to use a different ResourcePool every time you call the get() method. The ResourcePool::LoadBalancer can also detect a problem with a ResourcePool (e.g. because the related server is down) and will hide such problems from you.
There are currently three "Policies" which change the way the ResourcePool::LoadBalancer uses the configured resources:
RoundRobin
LeastUsage
FallBack
Learn More
You should have the big picture of ResourcePool and ResourcePool::LoadBalancer now, time to go into the details at the ResourcePool and ResourcePool::LoadBalancer documentation. If you loose track of all these modules consult the ResourcePool::UML diagram.
To learn more about how to implement your own resource extensions have a look to the ResourcePool::ExtensionGuide.
SEE ALSO
ResourcePool, ResourcePool::LoadBalancer, ResourcePool::UML
AUTHOR
Copyright (C) 2002 by Markus Winand <mws@fatalmind.com>
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 18:
=back doesn't take any parameters, but you said =back The overview of this two parts will be described in this document.