From: Markus W. <mw...@fa...> - 2002-06-04 07:37:24
|
i think my ResourcePool package can help you... the idea behind ResourcePool is a little bit different from what are you asking for. i think your real problem is not to implement a timeout (since, as you have pointed out, the node where the tcp connection is unkown would reply with an RST packet when it can't find this connection in the state table (the timeout would only be a problem if there would be no RST, which could happen if you have a firewall between your client and server)). i think the underlying layer (in that case Net::LDAP and all the libraries it uses) should immediately detect the broken connection and report a failure to the client code. then its up to the client code re-establish a connection and work on...and here, the ResourcePool can do a lot of work for you... if you are using ResourcePool you would not open any ldap connections directly, but just ask the ResourcePool to give you one. the ResourcePool will then ensure that there is a valid connection available (checks for staleness using bind()) and reopens a new connection if there is no valid connection available. There might be some performance issues in your configuration when using the ResourcePool but there are some ways around. however if you decide to go for it, i can give you some hints to avoid this issues. This package includes also a LoadBalancer module which is capable of doing a basic software loadbalancing across more servers and does a failover if one server breaks down. this package is available on CPAN and on my homepage http://www.fatalmind.com/projects/ResourcePool/ please note that there was a new release uploaded to CPAN just a few minutes ago (0.9904) which might not has reached your mirror jet... enjoy :) - - - - - - - - - - - - - Markus Winand e-mail: mw...@fa... web: www.fatalmind.com On Mon, 3 Jun 2002, Mike Richichi wrote: > I'm using perl-ldap for an Apache rewrite handler to provide mappings to > Novell NetWare home directories that are mounted as shares on our Linux > box. This means I'm binding once when Apache is started and the script > runs continually, with Apache passing things to the script to rewrite. > > We're transitioning to Novell Cluster Services, and it's easy to point > 'ldap' to the cluster IP address, which will always be available on a > cluster node. However, if the IP address moves, my script will no > longer work, as the LDAP connection no longer isn't known on the new > server (the TCP connection tables do not move over when the cluster > fails over). > > Thus I need to have a mechanism for timing out a bad connection and > rebinding in the event of a server failure. > > This would also be useful in general for sites doing round-robin DNS of > their ldap hostname, and resiliency in general. > > I feel that binding asynchronously and polling for results is the way to > go, but I've not seen an example of how to poll asynchronously in > perl-ldap. Has anyone done it? Alternately, can anyone suggest a > better way to detect a stale connection and attempt to rebind? > > Thanks for your help. > > --Mike > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > |