Starman

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        - Improved documentation
        - Ensure that chunk buffer contains terminating HTTP newline (Peter Makholm)

0.3000  Mon Feb 20 16:31:44 PST 2012
        - This be a 0.3 release

0.29_90 Thu Dec  1 19:40:52 PST 2011
        - Changed the way server handles HUP and QUIT signals
          HUP will just restart all the workers gracefully
          QUIT will gracefully shutdown workers and the master
          See `man 1 starman` and look for SIGNALS section.

0.2014  Sun Sep 18 12:43:06 PDT 2011
        - Fixed broken PSGI response headers after the output (cho45)

0.2013  Sat Jun 25 11:51:47 PDT 2011
        - Relaxed the harakiri tests (audreyt)

0.2012  Wed Jun 22 13:51:59 PDT 2011
        - Implemented psgix.harakiri mode (audreyt)
        - Added --error-log option (Paulo E. Castro)

Changes  view on Meta::CPAN

0.2003 Mon Apr 19 15:19:06 JST 2010
        - Upped Plack dependency

0.2002 Sat Apr 17 18:44:24 PDT 2010
        - Switch kyoto.jpg to use baybridge.jpg for testing

0.2001 Tue Apr 13 21:45:15 PDT 2010
        - Fixed the way to set the default Delayed loader

0.2000 Tue Apr 13 20:22:24 PDT 2010
        - INCOMPATIBLE: starman executable by default loads the application with Delayed to be safer.
          Use --preload-app command line option to preload the application in the master process.
          See `starman --help` for details.

0.1007 Tue Apr 13 19:45:59 PDT 2010
        - Fixed a bug where Content-Length less response are sent in Keep-Alive without chunked,
          choking HTTP/1.0 clients (patspam) #6

0.1006 Tue Apr 13 00:01:23 CEST 2010
        - Fixed 100% CPU loop when an unexpected EOF happens (Graham Barr)

0.1005 Sun Mar 28 14:37:03 PDT 2010
        - Implemented starman -v

0.1004 Sat Mar 27 19:10:06 PDT 2010
        - Implemented --disable-keepalive for broken frontend proxy such as mod_proxy + mpm_prefork
        - Documented --backlog 

0.1003 Sun Mar 21 21:08:39 PDT 2010
        - Fixed SERVER_PORT when used with Server::Starter (Reported by ronsavage)

0.1002 Wed Mar 10 12:10:46 JST 2010
        - Officially do not support Win32

MANIFEST  view on Meta::CPAN

MANIFEST
META.json
META.yml
README
cpanfile
dist.ini
lib/HTTP/Server/PSGI/Net/Server/PreFork.pm
lib/Plack/Handler/Starman.pm
lib/Starman.pm
lib/Starman/Server.pm
script/starman
t/00_compile.t
t/author-pod-syntax.t
t/chunked_req.t
t/chunked_termination.t
t/chunked_zero_length.t
t/early-hints.t
t/eintr.t
t/expect.t
t/findbin.psgi
t/harakiri.t

README  view on Meta::CPAN

NAME

    Starman - High-performance preforking PSGI/Plack web server

SYNOPSIS

      # Run app.psgi with the default settings
      > starman
    
      # run with Server::Starter
      > start_server --port 127.0.0.1:80 -- starman --workers 32 myapp.psgi
    
      # UNIX domain sockets
      > starman --listen /tmp/starman.sock

    Read more options and configurations by running `perldoc starman`
    (lower-case s).

DESCRIPTION

    Starman is a PSGI perl web server that has unique features such as:

    High Performance

      Uses the fast XS/C HTTP header parser

lib/Plack/Handler/Starman.pm  view on Meta::CPAN


Plack::Handler::Starman - Plack adapter for Starman

=head1 SYNOPSIS

  plackup -s Starman

=head1 DESCRIPTION

This handler exists for the C<plackup> compatibility. Essentially,
C<plackup -s Starman> is equivalent to C<starman --preload-app>,
because the C<starman> executable delay loads the application by
default. See L<starman> for more details.

=head1 AUTHOR

Tatsuhiko Miyagawa

=head1 SEE ALSO

L<Starman>

=cut

lib/Starman.pm  view on Meta::CPAN


=for stopwords

=head1 NAME

Starman - High-performance preforking PSGI/Plack web server

=head1 SYNOPSIS

  # Run app.psgi with the default settings
  > starman

  # run with Server::Starter
  > start_server --port 127.0.0.1:80 -- starman --workers 32 myapp.psgi

  # UNIX domain sockets
  > starman --listen /tmp/starman.sock

Read more options and configurations by running `perldoc starman` (lower-case s).

=head1 DESCRIPTION

Starman is a PSGI perl web server that has unique features such as:

=over 4

=item High Performance

Uses the fast XS/C HTTP header parser

lib/Starman/Server.pm  view on Meta::CPAN

            sleep 1;
        }
        $self->log(2, $self->log_time . " Worker processes cleaned up\n");
    }

    $self->SUPER::server_close();
}

sub run_parent {
    my $self = shift;
    $0 = "starman master " . join(" ", @{$self->{options}{argv} || []})
        if $self->{options}{proctitle};
    no warnings 'redefine';
    local *Net::Server::PreFork::register_sig = sub {
        my %args = @_;
        delete $args{QUIT};
        Net::Server::SIG::register_sig(%args);
    };
    $self->SUPER::run_parent(@_);
}

# The below methods run in the child process

sub child_init_hook {
    my $self = shift;
    srand();
    if ($self->{options}->{psgi_app_builder}) {
        DEBUG && warn "[$$] Initializing the PSGI app\n";
        $self->{app} = $self->{options}->{psgi_app_builder}->();
    }
    $0 = "starman worker " . join(" ", @{$self->{options}{argv} || []})
        if $self->{options}{proctitle};

}

sub post_accept_hook {
    my $self = shift;

    $self->{client} = {
        headerbuf => '',
        inputbuf  => '',

script/starman  view on Meta::CPAN

WARN
}

$runner->set_options(argv => \@argv);
$runner->run;

__END__

=head1 NAME

starman - Starman launcher

=head1 SYNOPSIS

  starman --listen :5001 --listen /tmp/starman.sock
  starman --workers 32 --port 8080

=head1 OPTIONS

=over 4

=item -l, --listen

  --listen HOST:PORT --listen :PORT --listen UNIX_SOCKET
  --listen HOST:PORT:ssl

script/starman  view on Meta::CPAN


  --port 8080

Specifies the port to bind.

This option is for compatibility with L<plackup> and you're
recommended to use C<--listen> instead.

=item -S, --socket

  -S /tmp/starman.sock

Specifies the path to UNIX domain socket to bind.

This option is for compatibility with L<plackup> and you're
recommended to use C<--listen> instead.

=item --workers

Specifies the size of the worker pool. Defaults to 5.

script/starman  view on Meta::CPAN

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 the C<-M> command line option (plackup's common
option) to preload the I<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 C<myapp.psgi> is done per child,
making management of resources such as database connections safer.

If you enable this option, sending a C<HUP> signal to the master process
I<will not> pick up any code changes you make. See L</SIGNALS> for
details.

=item --disable-keepalive

script/starman  view on Meta::CPAN

=item --ssl-key

Specify the path to the SSL key file.

=item --enable-ssl

Enable SSL on I<all> TCP sockets. This is an experimental feature.

=item --disable-proctitle

Disable the behavior to set proctitle to "starman (master)" and
"starman (worker)" respectively on master and workers.

=back

Starman passes through other options given to L<Plack::Runner>, the
common backend that L<plackup> uses, so most options explained in
C<plackup -h> (such as C<--access-log> or C<--daemonize>) work fine in
starman, too.

Setting the environment variable C<STARMAN_DEBUG> to 1 makes the
Starman server run in debug mode.

=cut

=head1 SIGNALS

=over 4

script/starman  view on Meta::CPAN

code changes you make by reloading the application.

If you enable C<--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 I<and> do graceful restarts
by reloading the code changes, you're recommended to use
L<Server::Starter>, configured to send C<QUIT> signal when superdaemon
received C<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 C<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
C<--signal-on-term> to QUIT so that you can safely shutdown Starman
first and then stop the C<start_server> daemon process as well.

=item TTIN, TTOU

Sending C<TTIN> signal to the master process will dynamically increase
the number of workers, and C<TTOU> signal will decrease it.

script/starman  view on Meta::CPAN

=head1 RELOADING THE APPLICATION

You're recommended to use signals (see above) to reload the
application, and are strongly discouraged to use C<-r> or C<-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 L<Server::Starter>.

=head1 DIFFERENCES WITH PLACKUP

C<starman> executable is basically the equivalent of using C<plackup>
with C<Starman> server handler i.e. C<plackup -s Starman>, except that
C<starman> delay loads the application with the Delayed loader by
default, which can be disabled with C<--preload-app>.

C<starman> command also automatically sets the environment (C<-E>) to
the value of I<deployment>.

You're recommended to use C<starman> unless there's a reason to stick to
C<plackup> for compatibility.

=head1 SEE ALSO

L<Starman>

=cut

t/release-findbin.t  view on Meta::CPAN

}

use Test::TCP;
use LWP::UserAgent;
use FindBin;
use Test::More;

my $s = Test::TCP->new(
    code => sub {
        my $port = shift;
        exec $^X, "script/starman", "--port", $port, "--max-requests=1", "--workers=1", "t/findbin.psgi";
    },
);

my $ua = LWP::UserAgent->new(timeout => 3);

for (1..2) {
    my $res = $ua->get("http://localhost:" . $s->port);
    is $res->content, $FindBin::Bin;
}

t/release-rand.t  view on Meta::CPAN

use LWP::UserAgent;
use FindBin;
use Test::More;

for (1..2) { # preload, non-preload
    my @preload = $_ == 1 ? ("--preload-app") : ();

    my $s = Test::TCP->new(
        code => sub {
            my $port = shift;
            exec $^X, "script/starman", @preload, "--port", $port, "--max-requests=1", "--workers=1", "t/rand.psgi";
        },
    );

    my $ua = LWP::UserAgent->new;

    my @res;
    for (1..2) {
        push @res, $ua->get("http://localhost:" . $s->port);
    }



( run in 0.816 second using v1.01-cache-2.11-cpan-e93a5daba3e )