note
gmax
<blockquote><i>my own db access module, which base classes DBI and over-ride execute() for this
</i></blockquote>
<p>I advise you against doing this.</p>
<p>Even if you succeed in changing the host overriding the <i>execute()</i> method (perhaps you should aim at <i>prepare()</i>), you would undermine any transaction that could be under way.</p>
<p>The MySQL replication schema may be unconvenient for its division of write-on-master and read-from-slaves, but it's rather solid. In my experience, using it with transactional tables (InnoDB) guarantees replication of transactions without a glitch.</p>
<p>The solution you are proposing is filter-based, and it's similar to the one offered from some commercial clusters, (emic networks, for example), which lose their transaction capabilities in the bargain.</p>
<p>Remember that, when using transactions, you should direct to the master the whole transaction, including any reading instruction within it. If you don't, you may get completely wrong results.</p>
<p>Instead of filtering, you could create an application wrapper, to send all modifying statements and transactions to the master, and rotate the slaves who should receive a simple read statement.</p>
<p>I don't know of any (public) Perl modules that deal with this problem. I may only recommend reading Jeremy Zawodny's <a href="http://www.oreilly.com/catalog/hpmysql/index.html">High Performance MySQL</a> (there is a sample chapter about replication).</p>
<p><b>Update</b><br>
If you are tempted to solve your problem by looking at <a href="http://dev.mysql.com/doc/mysql/en/ndbcluster.html">MySQL Cluster</a>, be aware that it's a completely different database system. Every node is at the same time master and slave, but you pay this luxury with a huge amount of RAM. According to the docs, in the current implementation, you need to have enough RAM to cover twice the size of your data, plus 20%. Therefore, if your data is 10 GB, your cluster must have 24 GB of RAM available (divided among all data nodes). There are plans of changing the in-memory architecture to something more resources-friendly, but don't hold your breath.
</p>
<div class="pmsig"><div class="pmsig-127116">
<pre>
_ _ _ _
(_|| | |(_|><
_|
</pre>
</div></div>
480609
480609