Is there some advantage in using a Perl PSGI daemon rather than a more standard combination of Apache+ModPerl+PSGI or Nginx+FastCGI+PSGI?
The utility of a standalone PSGI server seems pretty obvious for development, but not so obvious for production deployments. I would think that the performance hit for static files would be significant enough to outweigh the benefits of using a dedicated PSGI server. On Tue, 2015-06-09 at 13:02 +0000, Mark Allen via Houston wrote: > I just found out about Gazelle this morning - looks reeeeeally cool for PSGI > apps. > Gazelle - Preforked Plack Handler for performance freaks - metacpan.org > > | | > | | | | | | > | Gazelle - Preforked Plack Handler for performance freaks - > metacpan.orgPreforked Plack Handler for performance freaks | > | | > | View on metacpan.org | Preview by Yahoo | > | | > | | > > > > > > On Monday, June 8, 2015 10:32 PM, Michael R. Davis <[email protected]> > wrote: > > > Perl Folks, > >>> hoping that someone had already packaged up an RPM/PKG like Apache where > >>> I could just drop my PSGI script in the /etc/starman/pgsi/ folder and be > >>> off and running. Here's a cool URL mapper for Plack apps. It works > >>> great for Plack apps but it fails to pull in more than the first Mojo > >>> app. I have no idea why but load_psgi (`do "$filename"`) must work > >>> differently after the first Mojo app is loaded. Error: "Can't use string > >>> ("Mojolicious::Commands") as a subroutine ref while "strict refs" in use > >>> at /usr/share/perl5/vendor_perl/Plack/Middleware/Auth/Basic.pm line 30." > $ cat plack-builder-mount-deamon-folder.pl > #!/usr/bin/perl > use strict; > use warnings; > use Plack::App::URLMap qw{}; > use Plack::Util qw{};my %filenames = ( > '/p0' => 'plack.psgi', #works > '/p1' => 'plack.psgi', #works > '/p2' => 'plack.psgi', #works > '/p3' => 'plack.psgi', #works > '/p4' => 'plack.psgi', #works > '/p5' => 'plack.psgi', #works > '/m1' => 'mojo-lite-1.psgi', #works > '/m2' => 'mojo-lite-2.psgi', #fails > '/m3' => 'mojo-lite-3.psgi', #fails > '/m4' => 'mojo-lite-4.psgi', #fails > '/m5' => 'mojo-lite-5.psgi', #fails > );my $mapper = Plack::App::URLMap->new;foreach my $mount > (sort keys %filenames) { > my $filename = $filenames{$mount}; > my $app = Plack::Util::load_psgi($filename) or die($@); > die($@) unless ref($app) eq "CODE"; > $mapper->map($mount => $app); > print "Mapped: $mount to $filename ($app)\n"; > }my $system = $mapper->to_app; > --- $ cat plack.psgi#!/usr/bin/perl > use Plack::Builder;my $app = sub { > my $env = shift; > return [ > 200, > [ "Content-Type" => "text/plain", "Content-Length" => 11 ], > [ "Hello World" ], > ]; > };builder { > enable "Auth::Basic", authenticator => \&authen_cb; > $app; > };sub authen_cb { > my($username, $password, $env) = @_; > return $username eq 'user' && $password eq 'pass'; > } > --- $ cat mojo-lite.psgi > #perl > use strict; > use warnings; > use Plack::Builder qw{builder enable mount}; > use Mojolicious::Lite qw{app}; > use DateTime;get '/' => sub { > my $c = shift; > $c->render( > json => { > int => 1, > float => 2.23423, > exp => 34.45e27, > string => "hello world!", > dt => DateTime->now, > } > ); > }; get '/env' => sub { > my $c = shift; > $c->render( > text => join("", map {sprintf "%s: %s\n", $_, $ENV{$_}} sort > keys %ENV), > ); > }; sub authen_cb { > my($username, $password, $env) = @_; > return $username eq 'user' && $password eq 'pass'; > } builder { > enable "Auth::Basic", authenticator => \&authen_cb; app->start; #app from > Mojolicious::Lite > }; > --- Thanks, > Mike > > mrdvt92 > > > > _______________________________________________ Houston mailing list > [email protected] http://mail.pm.org/mailman/listinfo/houston Website: > http://houston.pm.org/
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Houston mailing list [email protected] http://mail.pm.org/mailman/listinfo/houston Website: http://houston.pm.org/
