DESCRIPTION

Mojo::Server::Prefork is a full featured, UNIX optimized, preforking non-blocking I/O HTTP and WebSocket server, built around the very well tested and reliable Mojo::Server::Daemon, with IPv6, TLS, Comet (long polling), keep-alive, connection pooling, timeout, cookie, multipart and multiple event loop support. Note that the server uses signals for process management, so you should avoid modifying signal handlers in your applications.

For better scalability (epoll, kqueue) and to provide IPv6 as well as TLS support, the optional modules EV (4.0+), IO::Socket::IP (0.20+) and IO::Socket::SSL (1.75+) will be used automatically by Mojo::IOLoop if they are installed. Individual features can also be disabled with the MOJO_NO_IPV6 and MOJO_NO_TLS environment variables.

accept_interval

Interval in seconds for trying to reacquire the accept mutex, defaults to 0.025. Note that changing this value can affect performance and idle CPU usage.

accepts

my $accepts = $prefork->accepts;
$prefork = $prefork->accepts(100);

Maximum number of connections a worker is allowed to accept before stopping gracefully, defaults to 1000. Setting the value to 0 will allow workers to accept new connections indefinitely. Note that up to half of this value can be subtracted randomly to improve load balancing, and that worker processes will stop sending heartbeat messages once the limit has been reached.

pid_file

workers

my $workers = $prefork->workers;
$prefork = $prefork->workers(10);

Number of worker processes, defaults to 4. A good rule of thumb is two worker processes per CPU core for applications that perform mostly non-blocking operations, blocking operations often require more and benefit from decreasing the number of concurrent "clients" in Mojo::Server::Daemon (often as low as 1).