The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Argon::Node

SYNOPSIS

    use EV; # use libev as event loop (see AnyEvent for details)
    use Argon::Node;

    my $node = Argon::Node->new(
        port         => 8000,
        host         => 'localhost',
        queue_limit  => 128,
        concurrency  => 8,
        max_requests => 512,
        manager      => 'otherhost:8000',
    );

    $node->start;

DESCRIPTION

Argon::Node is the workhorse of an Argon cluster. It maintains a pool of worker processes to which it delegates incoming requests. Nodes may be configured as a standalone service or as a member of a larger Argon cluster.

Nodes monitor their connection to the cluster and will automatically reconnect when a cluster becomes temporarily unavailable.

Argon::Node inherits Argon::Server.

METHODS

new(host => ..., port => ...)

Creates a new Argon::Node. The node does not automatically start listening.

Parameters:

host

Required. Hostname of the device to listen on.

port

Required. Port number on which to listen.

queue_limit

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.

concurrency

Required. Number of worker processes to maintain.

max_requests

Optional. Maximum number of requests any worker process may handle before it is terminated and a new process is spawned to replace it. This saves memory but may result in spiky responsiveness if set too low.

manager

Optional. Configures the Node to notify a manager of its availability to handle requests. Without this parameter, the Node is configured as a standalone server.

start

Starts the server. Blocks until shutdown is called.

shutdown

Causes the server to stop at the next available cycle. Onced called, each client will be disconnected and any pending messages will be failed.

AUTHOR

Jeff Ober mailto:jeffober@gmail.com

LICENSE

BSD license