Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: When does it make sense to preload modules when starting Starman?

by karlgoethebier (Abbot)
on Oct 28, 2021 at 11:08 UTC ( [id://11138141]=note: print w/replies, xml ) Need Help??


in reply to Re: When does it make sense to preload modules when starting Starman?
in thread When does it make sense to preload modules when starting Starman?

"... modules take a long time to initialize..."

Ja, ja or yes sure as you like. This is what common sense tells us.

But consider this funny little study i recently posted:

# app.psgi use strict; use warnings; use Plack::Request; use Plack::App::URLMap; use JSON::Tiny qw(encode_json); my $slash = sub { my $env = shift; my $json = encode_json {nose => 'cuke'}; my $status = 200; my $request = Plack::Request->new($env); my $headers = [ 'Content-Type' => 'application/json', 'Content-Length' => length $json, ]; my $body = [ $json ]; [ $status, $headers, $body ]; }; my $urlmap = Plack::App::URLMap->new; $urlmap->mount( "/" => $slash ); my $app = $urlmap->to_app; __END__

Preloading the Plack stuff? JSON::Tiny might be cheap but who knows.

It is really difficult to find answers for these questions.

And what if i daemonize Starman? The switches for this task are confusing.

Thanks for your kind reply and best regards, Karl.

P.S.: I asked the author. Probably he will enlight us.

«The Crux of the Biscuit is the Apostrophe»

  • Comment on Re^2: When does it make sense to preload modules when starting Starman?
  • Download Code

Replies are listed 'Best First'.
Re^3: When does it make sense to preload modules when starting Starman?
by LanX (Saint) on Oct 28, 2021 at 11:29 UTC
    > > "... modules take a long time to initialize..."

    > It is really difficult to find answers for these questions.

    Is it? To benchmark initialization, measure time in BEGIN, CHECK and INIT blocks.

    From what I heard is Moose a good candidate.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      "...From what I heard...Moose..."

      I do not plan no more to go for another mysterious traveller. Once upon a time i gave it a try and abandoned all hope afterwards as hostile takeover was my first impression. Your mileage may vary. Best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

        >hostile takeover

        You mean you don't like code that's 99% declarations and relies on 7 more levels of implicit occult behavior that's impossible to debug for a traditional Perl programmer? Moose is basically what mod_perlN is to Apache, except as applied back onto innocent Perl.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11138141]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-16 15:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found