Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Working towards PSGI, some questions

by Corion (Patriarch)
on Jan 08, 2016 at 07:12 UTC ( [id://1152268]=note: print w/replies, xml ) Need Help??


in reply to Working towards PSGI, some questions

Looking at Plack::Handler::Apache2, your app now runs under mod_perl.

As I assume that your PSGI application is more or less a raw PSGI application, returning [200, {}, ["Hello World"]], maybe you have Apache set up to restart the httpd after each request, which is great for debugging.

The easiest way to better confirm that your program is not run as a separate process would be some shared state between requests:

my $counter= 1; warn "(Re)initializing application $0\n"; return sub { [200, {}, ["Hello request " . $counter++]] };

If you cannot make $counter++ increase and constantly see the "(Re)initializing" message in your webserver error log, your webserver is running each request in a separate request.

You should get really different behaviour by using plackup with (for example) the Twiggy, Tatsumaki or another in-process backend.

Replies are listed 'Best First'.
Re^2: Working towards PSGI, some questions
by Cody Fendant (Hermit) on Jan 08, 2016 at 10:39 UTC

    Thanks, that was very helpful.

    The thing I'd missed was the instructions to preload the app, using a script:

    # Optionally preload your apps in startup PerlPostConfigRequire /etc/httpd/startup.pl

    As for going for another back end, that's a whole other thing I figure I'll get to next. All I know is Apache and a little bit of nginx, don't know where to start.

      I was and i'm still intersted in the topic: you may like to read Re: Change cgi script to PSGI app and Serving multiple Plack apps
      I also have other links on my homenode (..mmh that is a bit chaotic..)

      L*
      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

      I usually use one of the other server types for development, as they make process control much easier to me.

      Running one of the other server types behind an Apache or nginx reverse proxy is also possible, but requires much more setup.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-04-19 13:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found