1Starman(3pm) User Contributed Perl Documentation Starman(3pm)
2
3
4
6 Starman - High-performance preforking PSGI/Plack web server
7
9 # Run app.psgi with the default settings
10 > starman
11
12 # run with Server::Starter
13 > start_server --port 127.0.0.1:80 -- starman --workers 32 myapp.psgi
14
15 # UNIX domain sockets
16 > starman --listen /tmp/starman.sock
17
18 Read more options and configurations by running `perldoc starman`
19 (lower-case s).
20
22 Starman is a PSGI perl web server that has unique features such as:
23
24 High Performance
25 Uses the fast XS/C HTTP header parser
26
27 Preforking
28 Spawns workers preforked like most high performance UNIX servers
29 do. Starman also reaps dead children and automatically restarts the
30 worker pool.
31
32 Signals
33 Supports "HUP" for graceful worker restarts, and "TTIN"/"TTOU" to
34 dynamically increase or decrease the number of worker processes, as
35 well as "QUIT" to gracefully shutdown the worker processes.
36
37 Superdaemon aware
38 Supports Server::Starter for hot deploy and graceful restarts.
39
40 Multiple interfaces and UNIX Domain Socket support
41 Able to listen on multiple interfaces including UNIX sockets.
42
43 Small memory footprint
44 Preloading the applications with "--preload-app" command line
45 option enables copy-on-write friendly memory management. Also, the
46 minimum memory usage Starman requires for the master process is 7MB
47 and children (workers) is less than 3.0MB.
48
49 PSGI compatible
50 Can run any PSGI applications and frameworks
51
52 HTTP/1.1 support
53 Supports chunked requests and responses, keep-alive and pipeline
54 requests.
55
56 UNIX only
57 This server does not support Win32.
58
60 Here's a simple benchmark using "Hello.psgi".
61
62 -- server: Starman (workers=10)
63 Requests per second: 6849.16 [#/sec] (mean)
64 -- server: Twiggy
65 Requests per second: 3911.78 [#/sec] (mean)
66 -- server: AnyEvent::HTTPD
67 Requests per second: 2738.49 [#/sec] (mean)
68 -- server: HTTP::Server::PSGI
69 Requests per second: 2218.16 [#/sec] (mean)
70 -- server: HTTP::Server::PSGI (workers=10)
71 Requests per second: 2792.99 [#/sec] (mean)
72 -- server: HTTP::Server::Simple
73 Requests per second: 1435.50 [#/sec] (mean)
74 -- server: Corona
75 Requests per second: 2332.00 [#/sec] (mean)
76 -- server: POE
77 Requests per second: 503.59 [#/sec] (mean)
78
79 This benchmark was processed with "ab -c 10 -t 1 -k" on MacBook Pro 13"
80 late 2009 model on Mac OS X 10.6.2 with perl 5.10.0. YMMV.
81
83 Because Starman runs as a preforking model, it is not recommended to
84 serve the requests directly from the internet, especially when slow
85 requesting clients are taken into consideration. It is suggested to put
86 Starman workers behind the frontend servers such as nginx, and use HTTP
87 proxy with TCP or UNIX sockets.
88
90 psgix.informational
91 Starman exposes a callback named "psgix.informational" that can be used
92 for sending an informational response. The callback accepts two
93 arguments, the first argument being the status code and the second
94 being an arrayref of the headers to be sent. Example below sends an 103
95 Early Hints response before processing the request to build a final
96 response.
97
98 sub {
99 my $env = shift;
100
101 $env->{'psgix.informational'}->( 103, [
102 "Link" => "</style.css>; rel=preload"
103 ] );
104
105 my $rest = ...
106 $resp;
107 }
108
110 Tatsuhiko Miyagawa <miyagawa@bulknews.net>
111
112 Andy Grundman wrote Catalyst::Engine::HTTP::Prefork, which this module
113 is heavily based on.
114
115 Kazuho Oku wrote Net::Server::SS::PreFork that makes it easy to add
116 Server::Starter support to this software.
117
118 The "psgix.informational" callback comes from Starlet by Kazuho Oku.
119
121 Tatsuhiko Miyagawa, 2010-
122
124 This library is free software; you can redistribute it and/or modify it
125 under the same terms as Perl itself.
126
128 Plack Catalyst::Engine::HTTP::Prefork Net::Server::PreFork
129
130
131
132perl v5.38.0 2023-07-21 Starman(3pm)