Hello,as I am offering a free psgi / plack perl hosting at http://1.ai and I am currently using Plack::Handler::Apache2 I was wondering if there isany way to have the handler to behave a bit like passenger for ruby. My understanding is that with the current setup the perl app is reloaded at each requestand some developers rightly say that this is pretty ugly ;)
I know that I could reverse proxy and use starman but I was wondering if there is a better way a bit like passenger does for ruby. Of course I know that plack is verydifferent so it might not be possible. If this is the case would the setup I offer with Plack::Handler::Apache2 be sufficient to most (for testing, prototyping etc) ?Another thing is that I need to declare in the vhost the full path to the app. Is there any way to specify just a directory (again in ruby this is how passenger works and the name of the app is in the config.ru file).
If there is any way to improve the apache handler and you need some sponsorship for that just let me know :)
In alternative I could rework the system to behave a bit like other services like dotcloud or heroku hence using starman in reverse proxy…
Thanks in advanceDavid--
No, Plack::Handler::Apache2 compiles the psgi app on the first request and does NOT reload at each request.
It would be better to run isolated worker processes (with Starman or FastCGI), or even better, provide the isolated virtual environment with LXC (like Heroku, dotcloud and Stackato).
If there is any way to improve the apache handler and you need some sponsorship for that just let me know :)In alternative I could rework the system to behave a bit like other services like dotcloud or heroku hence using starman in reverse proxy…dotcloud uses uwsgi behind nginx.
uWSGI has solutions for practically all of the hosting-related scenarios
(you can see it as passenger with steroids without hiding the internals to
the sysadmin), but does not play well with 'static' webservers like apache
where config logic is not too smart/dynamic.
When users need to maintain apache, they tend to combine it with uwsgi's
fastrouter to give a 'brain' to apache, but its overhead could be
'relevant' on apache+massive hosting.
+1 for isolating users in jail/containers/lxc, i know it would means
rewriting the whole infrastructure, but if you want to give quality to
customers, security/isolation should be the first point on your list.
I don't understand what you mean by "Plack::Handler server script",
but Plack::Handler::Apache2 definitely compiles the app only once. If
you have multiple Apache children workers it will compile once for
each children, so it might look like it's reloading if you hit a
worker with no compiled result. To avoid that you can preload the apps
in the httpd.conf. These are documented in the POD docs.
> On a totally unrelated note you might consider adding a donation/sponsorship
> link to your page? I would be happy to show some support to your amazing
> work!
You can buy and promote the book http://handbook.plackperl.org/ to
give me a little bit of money, but otherwise I don't take donation nor
sponsorship for developments because money isn't my motivation and i
don't need a financial support. I would gladly take beer offers at
conferences party though :)
I don't understand what you mean by "Plack::Handler server script",
but Plack::Handler::Apache2 definitely compiles the app only once. If
you have multiple Apache children workers it will compile once for
each children, so it might look like it's reloading if you hit a
worker with no compiled result. To avoid that you can preload the apps
in the httpd.conf. These are documented in the POD docs.sorry for my poor working - what I meant is that if you run e.g. a dancer applicationusing starman and make some changes you need to restart starman to see the changes.This isn't the case with Plack::Handler::Apache2
hence the possible confusion in the dancer list :"...The reason you don't need restarts is because it loads everything on every request, like with CGI. That's slow and horrible. mod_perl has startup.pl[1] which helps deal with it, and on the Plack::Handler::Apache2 there's an example in the synopsis on handling the same thing....""....There's a difference between "slow and horrible" and incorrect. You're not doing anything incorrectly! :)The set up you have with Plack::Handler::Apache2 is correct but not optimal..."
hence my confusion. I don't see anything slow and horrible with Plack::Handler::Apache2 but, as I do have limited experience with perl app, I thought I would ask directly on this list. My benchmark shows that Plack::Handler::Apache2 is at least as fast.
> On a totally unrelated note you might consider adding a donation/sponsorship
> link to your page? I would be happy to show some support to your amazing
> work!
You can buy and promote the book http://handbook.plackperl.org/ to
give me a little bit of money, but otherwise I don't take donation nor
sponsorship for developments because money isn't my motivation and i
don't need a financial support. I would gladly take beer offers at
conferences party though :)Understood. I will buy a copy :) thanks again for your wonderful work that is much appreciated. I feel that you have taken perl web deployment to a totally new level.RegardsDavid
--
sorry for my poor wording - what I meant is that if you run e.g. a dancer application
using starman and make some changes you need to restart starman to see the changes.This isn't the case with Plack::Handler::Apache2
This _is_ the case unless you do some custom hackery on your own to enable reloading with middleware etc.
Sounds like they don't know what they are talking about or confused with mod_perl to run cgi scripts with Plack::Handler::CGI, which is quite different from using Plack apache2 handler.
sorry for my poor wording - what I meant is that if you run e.g. a dancer applicationusing starman and make some changes you need to restart starman to see the changes.This isn't the case with Plack::Handler::Apache2This _is_ the case unless you do some custom hackery on your own to enable reloading with middleware etc.If this is the case how does the reload takes place ?
When you upload a new file / save the file ? As you might know in passenger you need to do something like touch /tmp/restart.txt so it is the first thing I tried in the dancer app running using Plack::Handler::Apache2 and how it works with my standard installation is once the file is edited and saved (or uploaded from SFTP) the new modified app is up and running with no restart needed.
Sorry again if I am missing a simple point here.Sounds like they don't know what they are talking about or confused with mod_perl to run cgi scripts with Plack::Handler::CGI, which is quite different from using Plack apache2 handler.Great to know that this is not such an ugly solution :)
--
--