Login | Register
My pages Projects Community openCollabNet

Reply to message

* = Required fields
* Subject
* Body
Send reply to
Author (directly in email)
Please type the letters in the image above.

Original message

Author Christian Abegg <abegg.ch@gmail.com>
Full name Christian Abegg <abegg.ch@gmail.com>
Date 2007-11-18 08:59:06 PST
Message hi cameron, dear devs

thank you for your reply. i made a first try to implement it the way you
- the propel class initializes a PropelPDO object which acts as db
connection to the master server
- the PropelPDO object also holds an array of other PDO connections used for
read only queries

pro: realtively simple to implement, building up on the existing code
contra: PropelPDO extending PDO is no more used as a singe db connection

have a look at the two patches attached. they are a very first draft showing
the way I would choose.
http://www.nabble.co​m/file/p13820966/Pro​pel.diff Propel.diff
http://www.nabble.co​m/file/p13820966/Pro​pelPDO.diff PropelPDO.diff

please let me know if you'd appreciate any further work on that matter and
if there are architectural changes/constraints to be considered.


Cameron Brunner wrote:
> There is no reason this cant be done purely by slotting in a new
> PropelPDO layer with intelligence on what to send the query to IMO. I
> have thought this out before and it shouldn't be too painful depending
> upon just how smart you want it.
> On 11/3/07, Christian Abegg <abegg dot ch at gmail dot com> wrote:
>> hi
>> i'd like to use my propel app in an environment where the db-master is
>> replicated to one or more slave databases. the master gets the writing
>> statements, the slave gets the reading statements.
>> in my opinion, the propel layer would be appropriate implement that
>> function.
>> as far as i see, there is no such feature in propel.
>> after a short look into the generated base-classes, it seems like a
>> quite an easy task to implement a read-write splitting. assuming that
>> all reading queries call the "doSelectStmt" function, i'd introduce the
>> DATABASE_NAME_READ-constant which points to the configuration of the
>> slave-db.
>> for load balancing between multiple slave-db's i'd use the mysql-proxy.
>> but a simple round robin mechanism could be implemented in propel as
>> well.
>> i'm not sure wheter this approach could solve my problem. a big question
>> is: are the connection objects cached by propel? or is the $con-variable
>> always null if the user doesn't give a connection on the application
>> layer?
>> if that enhancement is considered usefull and could be implemented
>> within reasonable time, i'd be glad to help.
>> christian abegg
>> ps: my attempts to add an enhancement ticket failed beacaus they were
>> rejected as spam by trac.
>> --------------------​--------------------​--------------------​---------
>> To unsubscribe, e-mail: dev-unsubscribe@prop​el.tigris.org
>> For additional commands, e-mail: dev-help at propel dot tigris dot org
> --
> Cameron Brunner
> Want a better web browser?
> http://www.spreadfir​efox.com/?q=affiliat​es&id=182780​&t=1
> --------------------​--------------------​--------------------​---------
> To unsubscribe, e-mail: dev-unsubscribe@prop​el.tigris.org
> For additional commands, e-mail: dev-help at propel dot tigris dot org

View this message in context: http://www.nabble.co​m/r-w-splitting-in-m​aster-slave-db-repli​cation-environment-t​f4740128.html#a13820​966
Sent from the propel - dev mailing list archive at Nabble.com.