On Sep 16, 2009, at 14:02 , troels knak-nielsen wrote:
Hi.
I'm looking into replacing a legacy system with Zend_Db + subpackages
(Zend_Db_Table and friends), but I'm running into some problems. The
setup we have is a master/slave. For offloading the main server all
read queries are channelled to the slave, while all write queries are
sent to the main server. The current library supports this by allowing
each method to fetch the appropriate link. From what I can see, there
is no direct support for such a thing in Zend_db_Table, but I can see
a couple of possible flex points in the framework.
Before I start off a tangent myself, I was wondering if anybody else
have tried something like this?
Hi Troels,
You may find this earlier thread useful:
http://www.nabble.com/Best-practice-for-Master-Slave-Db-w--ZF--td24179039.html
In particular there is this bit about Solar, which obviously is not
Zend Framework but may provide useful hints.
http://www.nabble.com/Re%3A-Best-practice-for-Master-Slave-Db-w--ZF--p24204672.html
<selfpromotion>
This is as opposed to Solar's MysqlReplicated adapter, the SVN trunk
version of which works automatically. Yes, it examines the first few
characters of the SQL statement to determine whether it should pick a
master or a slave, which is not exactly a big performance drain. It
also manages GET-after-POST situations, so that if you insert or
update on one request, the very next request *also* uses the master
(even for reads), to allow time for data propagation to slaves.
Finally, you can switch back and forth between replicated and non-
replicated environments without changing your application code.
See more here:
http://solarphp.com/blog/read/19-adapter-for-master-slave-my-sql-setups
</selfpromotion>
--
Paul M. Jones
http://paul-m-jones.com/