http://qs321.pair.com?node_id=989110

andye has asked for the wisdom of the Perl Monks concerning the following question:

Hi fellow monks,

I'm converting an existing web application to a cloud environment.

I need to do failover / load balancing for the MySQL database connection.

One option I'm looking at is doing that from within Perl. (I'm aware that there are other options such as HAProxy etc - they have their pros and cons).

So, Perl module options for load balancing with failover for non-responsive connections seem to be:

Q1: Does anyone know of any other options?

I'm aware that each of these modules is designed for a slightly different scenario, but in fact any of them would fit the bill for my scenario, which is:

The existing code gets the database handle from a single library, so it's easy to modify the part where the connection is set up (i.e. my $dbh = whatever()). The part of the app which deals with both reads and writes is separate from the part of the app which just deals in reads (but in a higher volume), so it would be pretty easy to serve them up different database handles, if needed.

I have no experience using any of the above modules; I've been using DBI in general for about 10 years.

The app is running on Apache2, mod_perl2, Apache::DBI.

So, Q2: Does anyone have any experience with any of the above modules which they'd be willing to share?

Thoughts or recommendations?

I see that Tim Bunce is involved with DBD::Multiplex, behind the scenes, and that that module is now on v2. Those things make me think happy thoughts about it. I don't know anything much at all about the maintenance of the other two modules (not to say that it's not great, it may be fantastic, just that I'm ill-informed on this).

Thank you, and Happy Wednesday.