Argon::Cluster
use EV; # use libev as event loop (see AnyEvent for details) use Argon::Cluster; my $cluster = Argon::Cluster->new( port => 8000, host => 'localhost', queue_limit => 128, ); $cluster->start;
An Argon::Cluster is a manager on an Argon network. Argon::Nodes are configured (via the manager parameter) to report their availability to the cluster. The cluster manages nodes registered in this way and routes Argon::Messages to the most available node (based on past performance and the number of tasks it has queued vs the number of worker processes it has available).
If a node disconnects, it is automatically unregistered from the cluster until such a time as it reconnects. Any messages which had been routed to the node will fail and an error message returned to the requesting client (since it is impossible to retry the task without knowing what state it was in when the node failed).
Argon::Cluster inherits Argon::Server.
Creates a new Argon::Cluster. The node does not automatically start listening.
Parameters:
Required. Hostname of the device to listen on.
Required. Port number on which to listen.
Required. Size of the message queue. Any messages that come in after the queue has been filled with be rejected. It is up to the client to retry rejected messages.
Setting a large queue_limit will decrease the number of rejected messages but will make the server vulnerable to spikes in traffic density (e.g. a DOS attack or an unanticipated increase in traffic). Setting a lower queue_limit ensures that high traffic volumes do not cause the server to become bogged down and unresponsive. Note that in either case, the client will be waiting a longer time for a response; in the second case, however, the server will bounce back from traffic spikes much more quickly than in the first.
Starts the server. Blocks until shutdown is called.
Causes the server to stop at the next available cycle. Onced called, each client will be disconnected and any pending messages will be failed.
Jeff Ober mailto:jeffober@gmail.com
BSD license
To install Argon, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Argon
CPAN shell
perl -MCPAN -e shell install Argon
For more information on module installation, please visit the detailed CPAN module installation guide.