miyagawa / Starman

Starman is a high-performance preforking Perl PSGI web server
http://search.cpan.org/dist/Starman
Other
287 stars 84 forks source link

Support setting the process name #89

Closed nichtich closed 11 years ago

nichtich commented 11 years ago

Starman::Server sets the process name to "starman master" and "starman worker". If multiple instances of starman run parallel on multiple ports this is confusing. It would help to be able to assign a process name to an instance of starman. How about a launcher option --name?

miyagawa commented 11 years ago

Starman::Server sets the process name to "starman master" and "starman worker". If multiple instances of starman run parallel on multiple ports this is confusing.

I fail to see how setting (actually, sort of prepending) names is more confusing that doing nothing at all, since otherwise you can't even figure out which process is the master/worker.

Starman keeps the original argument in the process names, so if you have two clusters, with --port 8080 and --port 8081, you'll see (scroll to the right):

✗ ps auxww | grep starman
miyagawa       73693   0.0  0.1  2437476   2688 s007  S+    9:56AM   0:00.00 starman worker /Users/miyagawa/dev/Plack/eg/dot-psgi/Hello.psgi --port 8080    
miyagawa       73692   0.0  0.1  2437476   2688 s007  S+    9:56AM   0:00.00 starman worker /Users/miyagawa/dev/Plack/eg/dot-psgi/Hello.psgi --port 8080    
miyagawa       73644   0.0  0.1  2437476   2740 s010  S+    9:56AM   0:00.00 starman worker /Users/miyagawa/dev/Plack/eg/dot-psgi/Hello.psgi --port 8081    
miyagawa       73643   0.0  0.1  2437476   2740 s010  S+    9:56AM   0:00.00 starman worker /Users/miyagawa/dev/Plack/eg/dot-psgi/Hello.psgi --port 8081    

I don't think they're confusing.

nichtich commented 11 years ago

On Linux the legacy process name, set with prctl(2) on assignment to $0 since Perl 5.14, is truncated to 16 bytes, so only 10 characters left if you include the word "master" or "worker". Sure one can toggle on display of full command line in tools like ps (option x) and top (press c) but it would be more convenient to quickly distinguish starman instances by process name instead of first scanning for the process ID or for the full command line (your comment "scroll to the right" shows the problem). e.g. to restart an application named "hello":

killall -HUP hello-master
miyagawa commented 11 years ago

(your comment "scroll to the right" shows the problem).

That's just because i use the full output and the page width is short. I won't casually kill a process by just skimming the ps output anyway, since it's error prone (like you suggested, but see below)

e.g. to restart an application named "hello": killall -HUP hello-master

I would rather use a pid file option. (--pid and -D)