Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
There's more than one way to do things
 
PerlMonks  

Re: Data Structure Design

by kjherron (Pilgrim)
on Aug 17, 2001 at 04:11 UTC ( [id://105616]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Data Structure Design

First of all, let me commend you for being concerned with your data structures. Good data structures can make a program much simpler to understand and extend.

Anyway, I'd be inclined to do something like this:

my @clusters = ( { Name => 'cluster1', Workers => [ qw(h1 h2 h3 h4 h5 h6) ], Queen => 'h7' }, { ... } ); foreach my $cluster (@clusters) { foreach my $worker (@{$cluster->{Workers}}) { handle_worker($worker, ...); } handle_queen($cluster->{Queen}, ...); }
This is obviously very abstract. If you want to do all the workers in parallel you could. I also don't know if "workers" and "queen" correctly describes the relationship between these servers; you could probably think of better terms.

But this kind of arrangement gives you a lot of flexibility. For example, if another kind of server gets added to the mix later, it's trivial to add processing for it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://105616]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.