My experience with replication:

Most of the times, is good enough, fast enough... I have just reworked some
part of an application to split the reporting module from all other modules.


We are still using php 4.3 with pear::db module (what? legacy software is
hard to kill! we are trying!, Honest!)..

So, we need to pull 2 tricks, first of it was, that we setup replicatio to
two slaves... one for reporting, one for selects and had our master
instance.

we had an autoinclude file, which invoqued the db connection. The first
trick we pulled of was to detect if we where accesing the reports, by path
name using the a regexp over $_SERVER['SCRIPT_FILENAME'], if the filename
matched the modules regexp we instanciated the db connection to one of
slaves, the reports slave.

The other trick we made, was to modifie pear::db so we matched, again each
->query or ->simple_query against a regeexp containing the ^select pattern
and used the conection to the select database....

this allowed us to manage 3 databases, 1 for writing, 1 for selects and 1
for reporting with almos 0 changes to the actual code.

Hope this ideas work for you.

Maybe you aren't use php, but I bet you are using some kind of data base
abstraction layer...

Reply via email to