From: JT S. <jt...@pl...> - 2004-07-09 19:16:59
|
>1) Aren't there cases when people will want to update a central database >but not have admin on? For instance, posting to a "public" message >board. I'm assuming the RDBMS takes care of keeping this in sync? I >haven't had a need to set up replicated DBs yet. Yes there are, but in those cases the developer will the main database and not one of the replicants. In fact, all writes should use the master and not a slave. >2) Transparency == good, normally. The more difficult path for you is >probably the simplest for everyone. Could you explain what you mean by that? >What will adding replication do to performance for (an assumed majority) >of WebGUI users that run only one database? It will do nothing to the performance of the majority. They won't have to set anything up differently or anything else. In fact, I should have mentioned this before, if no slaves are defined then the master will always be used regardless. >On Fri, 2004-07-09 at 10:49, JT Smith wrote: >> I've been struggling over the last week with how to implement the ability to use a >> replicated database as a read source. I've experimented with about 10 different ways >>of >> doing this and all either didn't work or were way too convoluted to be useful. I've >>come >> down to two ways to implement this, but I need about 2 seconds of feedback from a >>couple >> of people on this list to make sure I'm on the right track. >> >> Way #1: Refactor WebGUI::SQL >> >> Change WebGUI::SQL to not use all those class methods, but instead instance methods. >>So >> we'd add several constructors and remove the ability to pass in a new database handler >> on each seperate method. The new constructors would be: >> >> new ( [ dbh ] ) >> >> This would default to the WebGUI db handler, but you could override it by passing in a >> dbh. This would be the common one everyone would use. >> >> >> newReplicant ( ) >> >> This would use a random one of the defined replicated databases, except if the user >>was >> in admin mode. >> >> >> newHandler ( dsn, user, pass [ , options ] ) >> >> This would create a new DBH and set it in the object instance. And would require the >>use >> of a disconnect() method to destroy it. >> >> >> So to use any of these you'd do something like this: >> >> >> my $db = WebGUI::SQL->newReplicant; >> my @arr = $db->quickArray($sql); >> >> >> >> >> Way #2: Progie does more work, but gets more control >> >> We leave WebGUI::SQL as is, except for adding one method like: >> >> WebGUI::SQL->getReplicant() >> >> >> Then the programmer in his code would write something like (when he wants to use a >> replicant): >> >> my $dbh = $session{dbh}; >> unless ($session{var}{adminOn} || $shouldntUseReplicant) { >> $dbh = WebGUI::SQL->getReplicant; >> } >> my @arr = WebGUI::SQL->quickAarry($sql,$dbh); >> >> >> >> Way #1 is cleaner, but requires refactoring all of WebGUI. (which I'll do if you guys >> think this is the best way to go) >> >> Way #2 is not nearly as clean, but requires no change to the rest of WebGUI. >> >> >> I hope to implement one of these in a few hours, so quick feedback is appreciated. >> >> >> JT ~ Plain Black >> >> Create like a god, command like a king, work like a slave. >> >> >> ------------------------------------------------------- >> This SF.Net email sponsored by Black Hat Briefings & Training. >> Attend Black Hat Briefings & Training, Las Vegas July 24-29 - >> digital self defense, top technical experts, no vendor pitches, >> unmatched networking opportunities. Visit www.blackhat.com >> _______________________________________________ >> Pbwebgui-development mailing list >> Pbw...@li... >> https://lists.sourceforge.net/lists/listinfo/pbwebgui-development >-- >*-._.-*^*-._.-*^*-._.-*^*-._.-*^*-._.-*^*-._.-*^*-._.-*^*-._.-* > >Daniel Collis Puro >CTO and Lead Developer, MassLegalServices.org >Massachusetts Law Reform Institute >99 Chauncy St., Suite 500 >Boston, MA 02111 >617-357-0019 ext. 342 >dp...@ml... >http://www.masslegalservices.org > > > >------------------------------------------------------- >This SF.Net email sponsored by Black Hat Briefings & Training. >Attend Black Hat Briefings & Training, Las Vegas July 24-29 - >digital self defense, top technical experts, no vendor pitches, >unmatched networking opportunities. Visit www.blackhat.com >_______________________________________________ >Pbwebgui-development mailing list >Pbw...@li... >https://lists.sourceforge.net/lists/listinfo/pbwebgui-development JT ~ Plain Black Create like a god, command like a king, work like a slave. |