Ofer Nave wrote: > > Couldn't an option be added as an alternative to db_stack that indicates > a desire for random ordering, thereby eliminating the need to precreate > all possible permutations? I'm imaging something like this (modified > version of your example): > > $DATABASE::conf{'test'} = { > max_retries => 2, > db_pool => [ > [ 'dbi:Sybase:server=prod1;database=test', 'user1', 'pass1', $attrib ], > [ 'dbi:Sybase:server=prod2;database=test', 'user2', 'pass2', $attrib ], > [ 'dbi:Sybase:server=prod3;database=test', 'user3', 'pass3', $attrib ], > ], ... > > So, db_stack maintains ordering, while db_pool tells DBIx::HA to > randomize the list of servers.
I like the idea of having this feature built-in, but I think the name could clearer, perhaps call it "load balance": $DATABASE::conf{'test'} = { load_balance => 1, db_stack => [ [ 'dbi:Sybase:server=prod1;database=test','user1','pass1',$attrib ], [ 'dbi:Sybase:server=prod2;database=test','user2','pass2',$attrib ], ], ... Mark