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.
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.

Henri.

On Friday, October 11, 2002, at 01:49 PM, Tim Bunce wrote:

On Fri, Oct 11, 2002 at 12:50:15PM -0700, Henri Asseily wrote:
This is somewhat OT, but I need an answer from within the DBI community:

I want to release a new DBIx module, DBIx::HA (for High Availability).
What will it do, and how?

In this module I need to do some work on shared memory segments. What
Perl module is most in use to do that? i.e. which module should I
support?
I was thinking about IPC::ShareLite. Is that one the "best" in terms of
distribution, or are other ones more ubiquitous?
What about IPC::Shareable?
There are many to consider, including IPC::MM and others.

There was a talk by Perrin Harkins at this years Perl Conference
http://conferences.oreillynet.com/cs/os2002/view/e_sess/2801
that compared and benchmarked many of the modules - it was a good,
well designed, review that considered many issues people would often
forget.

Sadly his presentation isn't online here
http://conferences.oreillynet.com/pub/w/15/presentations.html
so I've CC'd Perrin in the hope that he'll post a url for it.

Tim.



Reply via email to