On Thu, Jan 04, 2007 at 02:54:37PM -0500, Mark Stosberg wrote:
> 
> Hello,
> 
> Today I've been researching database load balancing solutions to use
> with an Apache/mod_perl application and a PostgreSQL database. Right now
> I'm using Slony-I for replication, and it seems to work well enough.

> #####
> 
> What's beginning to appeal to me know is to solve part load balancing in
> the application by using two database handles: a read/write one, and a
> read-only one. From there, it's much easier problem to solve: The R/w
> handle always talks to the master and the Read-only handle can be load
> balanced without being so "smart".

A wise approach. I believe DBIx::Class is taking that approach.

> Some further details about going this route:
> 
>    - I would leave the default handle as "read-write". That means if I
> accidently miss converting a handle to "read only" somewhere, it will
> still work, it just won't be load-balanced.
> 
>    - CGI::Application::Plugin::DBH will make adding the second handle
> easy. I'll still use $self->dbh() to access the default handle, and
> $self->dbh('ro') for the new Read-only handle.
> 
>     - DBD::Multi looks like it could handle this kind of simple load
> balancing. As a bonus, it has some fail-over logic in it, so if the
> slave was unvailable for a bit, that would be handled transparently.
> 
> Does that seem sound? What's worked for you?

Also take a look at DBIx::HA.

Tim.

Reply via email to