On Mon, 2006-02-27 at 17:37 +0100, Dries Buytaert wrote:
I will point to the fact that currently drupal will not support mysql's replication technology since we haven't implemented a concept of slave/master...
Two quick ways I can think of adding it are... 1) further db abstraction ala, db_select, db_insert, db_update..... 2) and using a if (!strpos('SELECT', $query)) { db_set_active('master') } in db_query.
with 1) you may get slightly better performance since you aren't constantly parsing strings, but you start making some major changes to drupal's db_abstraction layer.
Are you suggesting that we add a connection pooling mechanism to Drupal? I'm not convinced that is a good idea. There are both software and hardware load balancer that do exactly that. You open a MySQL connection to db-server.example.com (the load balancer) which map it onto db-server-1.example.com, db-server-2.example.com, etc. These load balancers can do 'health checks' to see if the database servers are still running, whether they are in a consistent state, whether they are properly replicated, etc. Good health checks can be complicated and therefore this could be tricky to implement in PHP ...
-- Dries Buytaert :: http://www.buytaert.net/
In no way am I suggesting adding connection pooling. That's far outside of the scope of my suggestion... Mysql's replication only supports a single master/write server, so drupal needs to know to which server to query for write operations. I can implement my own mysql load balancing through sqlrelay, round-robin dns, or LVS. But none of them will get my UPDATE, INSERT, CREATE, ALTER, etc queries to my mysql master server. The db abstraction layer is where I've placed this logic in the past.