On Fri, Oct 11, 2002 at 02:27:21PM -0700, Henri Asseily wrote: > Perrin, thanks for the synopsis of shm modules. I'll be using IPC::MM, > since I neither need serialization nor presistence. > > Regarding what I've dubbed DBIx::HA, here's the idea: > > There hasn't been up to now (or at least I haven't found any) a widely > available Perl/DBI-based system for system architects who handle > high-availability groups of servers, either in read-only load-balanced > mode or read-write hot-backup mode.
Have you looked at DBD::Multiplex? > Oracle, Sybase and others do offer high-availability options, but they > cost upward of $30,000 for a single implementation. In addition, I > tested Sybase's OpenSwitch which does not cooperate properly with DBI, > but that's a story for another day. > > Anyway, I've built a pretty small (300 lines) module that uses DBI's > subclassing technique to allow the following: > > - the creation of logical "server groups" comprised of many DSNs > - seamless usage of those server groups, where a client script simply > states that it wants to connect to that logical server > - load-balanced or hot-backup mode > - if running under Apache, support for Apache::DBI and support for > failing over one child at a time (overflow mode) or the full server at > once (complete switch for read-write hot-backup mode) > - automatic verification of the connection only if connect or execute > fails (it bypasses the Apache::DBI ping system which is worthless), and > automatic reconnect X times, then failover to next available server in > stack. Executed statement is retried once only if connection works, so > as not to end up failing over in case it's just a SQL error. > - choice of using this HA system on a dsn by dsn basis (thanks to the > excellent DBI "RootClass" subclassing) > - no need to restart the script or reload the webpage if the active > server fails. > - support for callback of a cleanup function when the active dbh needs > to be cleared (where for example, a web application cached the dbh in > the session object and needs to clear it before the HA system switches > to another server) > > The only small piece left to code is the support for failing over the > whole server. The mod_perl children need to communicate to each other > the state of the system and the currently active dbh, and thus my > question regarding SHM. That is trivial, though. This all sounds excellent. I'd be interested in your thoughts on DBD::Multiplex, both specifically and the underlying concept of using a 'virtual driver' to encapsulate the functionality. Tim.