NAME

Plack::Handler::Feersum - plack adapter for Feersum

SYNOPSIS

plackup -s Feersum app.psgi
plackup -s Feersum --listen localhost:8080 app.psgi
plackup -s Feersum --pre-fork=4 -MMy::App -L delayed app.psgi

DESCRIPTION

This is a stub module that allows Feersum to be loaded up under plackup and other Plack tools. Set $ENV{PLACK_SERVER} to 'Feersum' or use the -s parameter to plackup to use Feersum under Plack.

Experimental Features

Always use the --key=value form for these options. plackup turns a valueless --flag into flag => <next argument>, so a bare --reuseport silently swallows the option that follows it (or the app filename).

A --pre-fork=N parameter can be specified to put feersum into pre-forked mode where N is the number of child processes. --preload-app=0 is not usable through plackup on its own: plackup always compiles the app before the fork, and a coderef cannot be re-loaded per worker, so Feersum croaks with preload_app => 0 requires app_file. Adding --app-file=... satisfies that, but the app plackup already compiled is still the one served. For a genuinely per-worker load, drive Feersum::Runner directly with app_file and no app.

A --reuseport=1 parameter can be specified to enable SO_REUSEPORT support for better multi-core scaling when combined with --pre-fork. Requires Linux 3.9+ or similar kernel support.

Watcher priority options --read-priority, --write-priority, and --accept-priority can be used to set libev I/O watcher priorities. Valid range is -2 (lowest) to +2 (highest), default is 0.

TLS, HTTP/2, and PROXY protocol can be configured via plackup's pass-through server options (use the --key=value form so a flag's value is not mistaken for the app filename):

plackup -s Feersum \
  --tls-cert-file=server.crt --tls-key-file=server.key \
  --h2=1 --proxy-protocol=1 app.psgi

Note: The sni option (for virtual hosting with multiple TLS certificates) takes an array of hashes and cannot be set on the command line; use Feersum::Runner directly for SNI configuration.

A server_ready callback (a code reference, so only settable when the handler is constructed programmatically, e.g. via Plack::Loader) is invoked once the listening sockets are bound; it receives the handler object as its only argument. With daemonize it fires in the foreground process before daemonization, and it is not invoked at all under hot_restart (generations bind their sockets outside the code path that calls it).

See Feersum::Runner for full documentation of these options.

METHODS

assign_request_handler($app)

Assigns the PSGI request handler to Feersum.

SIGTERM is handled by Feersum::Runner::run(), which calls quit(), so Plack::Loader::Restarter works.

SEE ALSO

Most of the functionality is in Feersum::Runner (the base class)

AUTHOR

Jeremy Stashewsky, stash@cpan.org

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Jeremy Stashewsky & Socialtext Inc.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14 or, at your option, any later version of Perl 5 you may have available.