[Dbix-class] Replicated DB - Best Practices

2009-03-24 Thread Dave Cross


I'm looking for some advice on best practice for dealing with replicated 
MySQL databases.


My current client has a large database which is split across a RW master 
and several RO slaves (I believe that's how MySQL replication always 
works). They're just toying with replacing a lot of their DB code with 
DBIx::Class.


I assume that other people have been working with similar architecture 
and I'd be grateful for any advice you might have. In particular we're 
thinking about problems like:


* How to decide whether to connect to the master or the slave
* Do we maintain a pool of database handles to both masters and slaves.
* Whether it ever makes sense to upgrade a slave connection to a master 
connection on the fly
* How referential integrity works in a world where a slave can be out of 
date compared to the master (actually, we know the answer to that one - 
it doesn't)


All suggestions, gratefully received.

Cheers,

Dave...

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] Replicated DB - Best Practices

2009-03-24 Thread John Goulah
On Tue, Mar 24, 2009 at 8:23 AM, Dave Cross d...@dave.org.uk wrote:

 I'm looking for some advice on best practice for dealing with replicated
 MySQL databases.

 My current client has a large database which is split across a RW master and
 several RO slaves (I believe that's how MySQL replication always works).
 They're just toying with replacing a lot of their DB code with DBIx::Class.

 I assume that other people have been working with similar architecture and
 I'd be grateful for any advice you might have. In particular we're thinking
 about problems like:

 * How to decide whether to connect to the master or the slave
 * Do we maintain a pool of database handles to both masters and slaves.
 * Whether it ever makes sense to upgrade a slave connection to a master
 connection on the fly
 * How referential integrity works in a world where a slave can be out of
 date compared to the master (actually, we know the answer to that one - it
 doesn't)

 All suggestions, gratefully received.




Dave,

DBIx::Class::Storage::DBI::Replicated  will handle this for you

http://search.cpan.org/~ribasushi/DBIx-Class-0.08099_07/lib/DBIx/Class/Storage/DBI/Replicated.pm

Thanks,
John

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] Replicated DB - Best Practices

2009-03-24 Thread Rob Kinyon
On Tue, Mar 24, 2009 at 08:23, Dave Cross d...@dave.org.uk wrote:

 I'm looking for some advice on best practice for dealing with replicated
 MySQL databases.

 My current client has a large database which is split across a RW master and
 several RO slaves (I believe that's how MySQL replication always works).
 They're just toying with replacing a lot of their DB code with DBIx::Class.

MySQL replication can be master/master, but it's usually master/slave(s).

 * How to decide whether to connect to the master or the slave

Generally, you want to connect to the master if your transaction has
any mutations, but to the slave otherwise. You will very often know
that a given request will not require mutations (such as a report).

 * Do we maintain a pool of database handles to both masters and slaves.

You could, or just let Replicated deal with it for you.

 * Whether it ever makes sense to upgrade a slave connection to a master
 connection on the fly

Replicated deals with this.

 * How referential integrity works in a world where a slave can be out of
 date compared to the master (actually, we know the answer to that one - it
 doesn't)

Referential integrity works just fine and is really only applicable to
the master. So long as the master enforces referential integrity, the
slaves will have referential integrity.

Rob

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


[Dbix-class] DBIC and Moose

2009-03-24 Thread Andreas Mock
Hi all,

I wrote once somewhere that DBIC shall use Moose sometime.
Do I remember this right? What are the plans?
If yes, is Moose used to build up the classes of DBIC or also
using the reflection features of Moose to make Moose-compatible
objects persistent?

Best regards
Andreas



___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] DBIC and Moose

2009-03-24 Thread Rob Kinyon
 Just wanted to ask if I'm right that I heard that DBIC wants to use Moose
 in the future. And if yes, what are the plans.

The plan is that 0.09 will both use Moose and be very Moose-friendly.
When that will happen is largely dependent on people helping out. Come
help?

Thanks,
Rob

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk