-
-
20 Dec 2013 07:09:33 UTC
- Distribution: Twiggy-Prefork
- Module version: 0.08
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (1)
- Testers (567 / 10 / 0)
- Kwalitee
Bus factor: 1- 91.51% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (15KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 3 contributors- Masahiro Nagano <kazeburo {at} gmail.com>
-
nhayashi
-
soh335
NAME
Twiggy::Prefork - Preforking AnyEvent HTTP server for PSGI
SYNOPSIS
$ plackup -s Twiggy::Prefork -a app.psgi
DESCRIPTION
Twiggy::Prefork is Preforking AnyEvent HTTP server for PSGI based on Twiggy. This server supports,
- Min/Max Request Per Child
-
supports Min/Max Request Per Child feature.
- Superdaemon aware
-
Supports Server::Starter for hot deploy and graceful restarts.
To use it, instead of the usual:
plackup --server Twiggy::Prefork --port 8111 app.psgi
install Server::Starter and use:
start_server --port 8111 plackup --server Twiggy::Prefork app.psgi
OPTIONS
- max_workers
-
number of worker processes (default: 10)
- max_reqs_per_child
-
max. number of requests to be handled before a worker process exits. If passed 0, child process is not existed by number of requests (default: 100).
- min_reqs_per_child
-
if set, randomizes the number of requests handled by a single worker process between the value and that supplied by --max-reqs-per-child (default: none)
PSGI extensions
- psgix.exit_guard
-
AnyEvent::CondVar object. You can make graceful stop mechanism with this variable.
use Coro; use AnyEvent; my $channel = Coro::Channel->new(100); async { while(1){ my $q = $channel->get; # works.. $q[0]->end; } }; #psgi app sub { my $env = shift; my $cv = AE::cv; async { $env->{psgix.exit_guard}->begin; $channel->put([$env->{psgix.exit_guard}]); $cv->send; }; return sub { my $start_response = shift; $cv->cb(sub { $start_response->([200,['Content-Type'=>'text/plain'],['OK']]); }); } }
Block Twiggy::Prefork worker process exiting until your jobs done.
AUTHOR
Masahiro Nagano <kazeburo {at} gmail.com>
Shigeki Morimoto
SEE ALSO
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install Twiggy::Prefork, copy and paste the appropriate command in to your terminal.
cpanm Twiggy::Prefork
perl -MCPAN -e shell install Twiggy::Prefork
For more information on module installation, please visit the detailed CPAN module installation guide.