Clutch::Worker - distributed job system's worker class
# worker package Your::Worker; use strict; use warnings; use Clutch::Worker; register_function( 'echo' => sub { my $args = shift; $$ .':'. $args; # return worker process response. } ); 1; # worker start script by single process #! perl use strict; use warnings; use Your::Worker; Your::Worker->new( { address => "$ip:$port", } )->run(); # stop by TERM signal to this process # worker start script by multi prefork process #! perl use strict; use warnings; use Your::Worker; Your::Worker->new( { address => "$ip:$port", max_workers => $worker_num, max_reqs_per_child => $max_reqs_per_child, } )->new();
worker process function name.
client process specific this functin name.
client process call the function, execute thid $callback_coderef.
$callback_coderef's first argument is a client request parameter.
worker process listen address.
worker process can tells itself address for admin daemon, if admin daemon starting.
seconds until timeout (default: 10)
number of worker processes (default: 0)
if max_workers is 0, worker start single process mode.
if you specific max_workers Zero or more, do prefork worker process.
if set, worker processes will not be spawned more than once than every given seconds. Also, when SIGHUP is being received, no more than one worker processes will be collected every given seconds. This feature is useful for doing a "slow-restart". See http://blog.kazuhooku.com/2011/04/web-serverstarter-parallelprefork.html for more information. (dedault: none)
max. number of requests to be handled before a worker process exits (default: 100)
1 POD Error
The following errors were encountered while parsing the POD:
=over without closing =back
To install Clutch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Clutch
CPAN shell
perl -MCPAN -e shell install Clutch
For more information on module installation, please visit the detailed CPAN module installation guide.