STARMAN(1p) | User Contributed Perl Documentation | STARMAN(1p) |
starman - Starman launcher
starman --listen :5001 --listen /tmp/starman.sock starman --workers 32 --port 8080
--listen HOST:PORT --listen :PORT --listen UNIX_SOCKET --listen HOST:PORT:ssl
Specifies the TCP address, ports and UNIX domain sockets to bind to wait for requests. You can repeat as many times as you want and mix TCP and UNIX domain sockets.
For TCP sockets you can append ":ssl" after the port to specify that connections on that port should use SSL. Note that the SSL support is experimental and hasn't been widely tested.
Defaults to any IP address and port 5000.
--host 127.0.0.1
Specifies the address to bind.
This option is for a compatibility with plackup and you're recommended to use "--listen" instead.
--port 8080
Specifies the port to bind.
This option is for a compatibility with plackup and you're recommended to use "--listen" instead.
-S /tmp/starman.sock
Specifies the path to UNIX domain socket to bind.
This option is for a compatibility with plackup and you're recommended to use "--listen" instead.
Starman by default sets up other spare server configuration based on this workers value, making sure there are always only "N" worker processes running. So even if there're no idle workers, Starman won't spawn off spare processes since that's mostly what you want to do by fine tuning the memory usage etc. in the production environment.
On production systems, setting a very low value can allow failover on frontend proxy (like nginx) to happen more quickly, if you have multiple Starman clusters.
If you're doing simple benchmarks and getting connection errors, increasing this parameter can help avoid them. You should also consider increasing "net.core.somaxconn". Note that this is not recommended for real production system if you have another cluster to failover (see above).
Enabling this option can cause bad things happen when resources like sockets or database connections are opened at load time by the master process and shared by multiple children.
Since Starman 0.2000, this option defaults to false, and you should explicitly set this option to preload the application in the master process.
Alternatively, you can use -M command line option (plackup's common option) to preload the modules rather than the <application> itself.
starman -MCatalyst -MDBIx::Class myapp.psgi
will load the modules in the master process for memory savings with CoW, but the actual loading of "myapp.psgi" is done per children, allowing resource managements such as database connection safer.
If you enable this option, sending "HUP" signal to the master process will not pick up any code changes you make. See "SIGNALS" for details.
Defaults to 1.
Defaults to 5.
Defaults to the current userid.
Defaults to the current group id.
Starman passes through other options given to Plack::Runner, the common backend that plackup uses, so the most options explained in "plackup -h" such as "--access-log" or "--daemonize" works fine in starman too.
Setting the environment variable "STARMAN_DEBUG" to 1 makes the Starman server running in the debug mode.
If you enable "--preload-app" option, however, the code will be only loaded in the startup process and will not pick up the code changes you made. If you want to preload the app and do graceful restarts by reloading the code changes, you're recommended to use Server::Starter, configured to send "QUIT" signal when superdaemon received "HUP", i.e:
start_server --interval 5 --port 8080 --signal-on-hup=QUIT -- \ starman --preload-app myapp.psgi
You will then send the HUP signal to "start_server" process to gracefully reload the starman cluster (master and workers).
With Server::Starter 0.12 or later, you should also be able to set "--signal-on-term" to QUIT so that you can safely shutdown Starman first and then stop the "start_server" daemon process as well.
You're recommended to use signals (see above) to reload the application, and are strongly discouraged to use "-r" or "-R" (reloading flag) from plackup. These options will make a separate directory watcher process, and makes your life difficult if you want to combine with other process daemon tools such as Server::Starter.
"starman" executable is basically the equivalent of using "plackup" with "Starman" server handler i.e. "plackup -s Starman", except that "starman" delay loads the application with the Delayed loader by default, which can be disabled with "--preload-app".
"starman" command also automatically sets the environment ("-E") to the value of deployment.
You're recommended to use "starman" unless there's a reason to stick to "plackup" for compatibility.
Starman
2022-09-16 | perl v5.34.0 |