NAME

SYNOPSIS

DESCRIPTION

Mojo::Server::Hypnotoad 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::Prefork, with IPv6, TLS, Comet (long polling), keep-alive, multiple event loop and hot deployment support that just works. Note that the server uses signals for process management, so you should avoid modifying signal handlers in your applications.

To start applications with it you can use the hypnotoad script, which listens on port 8080, automatically daemonizes the server process and defaults to production mode for Mojolicious and Mojolicious::Lite applications.

This second invocation will load the application again, detect the process id file with it, and send a "USR2" signal to the already running server.

For better scalability (epoll, kqueue) and to provide non-blocking name resolution, SOCKS5 as well as TLS support, the optional modules EV (4.0+), Net::DNS::Native (0.15+), IO::Socket::Socks (0.64+) and IO::Socket::SSL (1.94+) will be used automatically if possible. Individual features can also be disabled with the MOJO_NO_NDN, MOJO_NO_SOCKS and MOJO_NO_TLS environment variables.

QUIT

SETTINGS

accepts

accepts => 100

Maximum number of connections a worker is allowed to accept before stopping gracefully and then getting replaced with a newly started worker, defaults to the value of "accepts" in Mojo::Server::Prefork. 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.

backlog

clients

clients => 100

Maximum number of concurrent connections each worker process is allowed to handle before stopping to accept new incoming connections, defaults to the value of "max_connections" in Mojo::IOLoop. Note that high concurrency works best with applications that perform mostly non-blocking operations, to optimize for blocking operations you can decrease this value and increase "workers" instead for better performance.

heartbeat_timeout

inactivity_timeout

inactivity_timeout => 10

Maximum amount of time in seconds a connection can be inactive before getting closed, defaults to the value of "inactivity_timeout" in Mojo::Server::Daemon. Setting the value to 0 will allow connections to be inactive indefinitely.

user

workers

workers => 10

Number of worker processes, defaults to the value of "workers" in Mojo::Server::Prefork. 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 concurrency with "clients" (often as low as 1). Note that during zero downtime software upgrades there will be twice as many workers active for a short amount of time.