Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Plack::Handler::Apache2 in multi hosting vs passenger
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
gurugeek  
View profile  
 More options Sep 20 2012, 1:45 pm
From: gurugeek <1...@1.ai>
Date: Thu, 20 Sep 2012 10:45:56 -0700 (PDT)
Local: Thurs, Sep 20 2012 1:45 pm
Subject: Plack::Handler::Apache2 in multi hosting vs passenger

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 is
any 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 request
and 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 very
different 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 advance
David


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tatsuhiko Miyagawa  
View profile  
 More options Sep 20 2012, 7:24 pm
From: Tatsuhiko Miyagawa <miyag...@gmail.com>
Date: Fri, 21 Sep 2012 08:24:20 +0900
Local: Thurs, Sep 20 2012 7:24 pm
Subject: Re: Plack::Handler::Apache2 in multi hosting vs passenger

On Sep 21, 2012, at 2:45 AM, gurugeek wrote:

> 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 is
> any 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 request
> and some developers rightly say that this is pretty ugly ;)

No, Plack::Handler::Apache2 compiles the psgi app on the first request and does NOT reload at each request.

> 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 very
> different 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).

AFAIK there's no implementation like Passenger- style dynamic workers, but uWSGI might be worth looking into if you want to host multiple apps inside the web servers.

However it is dangerous to provide access to the same perl interpreter to multiple tenants anyway, for obvious security reasons with code and memory sharing.

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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roberto De Ioris  
View profile  
 More options Sep 21 2012, 1:09 am
From: "Roberto De Ioris" <robe...@unbit.it>
Date: Fri, 21 Sep 2012 07:09:31 +0200
Local: Fri, Sep 21 2012 1:09 am
Subject: Re: Plack::Handler::Apache2 in multi hosting vs passenger

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.

--
Roberto De Ioris
http://unbit.it


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gurugeek  
View profile  
 More options Sep 22 2012, 12:12 pm
From: gurugeek <1...@1.ai>
Date: Sat, 22 Sep 2012 09:12:03 -0700 (PDT)
Local: Sat, Sep 22 2012 12:12 pm
Subject: Re: Plack::Handler::Apache2 in multi hosting vs passenger

On Friday, September 21, 2012 1:24:24 AM UTC+2, Tatsuhiko Miyagawa wrote:

> No, Plack::Handler::Apache2 compiles the psgi app on the first request and
> does NOT reload at each request.

This is great news ! :) So in terms of performance what is the difference
between running an app under plack::handler::apache2 vs. starman with e.g.
10 workers?
e.g. on http://dancer.1.ai I am running starman 10 workers and on
http://elephant.1.ai/perl Plack::Handler and while it is difficult to
benchmark such a simple script it looks like Plack::Handler is at least as
fast.   Another question: changes to the plack::handler server script do
not need a restart (hence some users claimed it was reloading at each
request) is there something I am missing ?

> 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).

> I agree. I tried something different too: running each app in a bsd jail

and reverse proxing it via nginx. This seems (security-wise) a good
solution too ?

> 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.

 I would certainly try it .

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gurugeek  
View profile  
 More options Sep 22 2012, 12:15 pm
From: gurugeek <1...@1.ai>
Date: Sat, 22 Sep 2012 09:15:17 -0700 (PDT)
Local: Sat, Sep 22 2012 12:15 pm
Subject: Re: Plack::Handler::Apache2 in multi hosting vs passenger

> 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.

I understand. The benefit of apache for now was that it runs each script as
the unprivileged user and I didn't find the same option with nginx.
Obviously this is not needed if the app is isolated in a container.

> 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.

> Thank you I will certainly change the system in this direction. The only

problem I faced is on the ruby in a bsd jail + thin + nginx simple scripts
worked fine but more complex ones did not. I did not have the same problem
with starman. More testing is needed perhaps !

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tatsuhiko Miyagawa  
View profile  
 More options Sep 22 2012, 4:15 pm
From: Tatsuhiko Miyagawa <miyag...@gmail.com>
Date: Sun, 23 Sep 2012 05:08:05 +0900
Local: Sat, Sep 22 2012 4:08 pm
Subject: Re: Plack::Handler::Apache2 in multi hosting vs passenger

On Sun, Sep 23, 2012 at 1:12 AM, gurugeek <1...@1.ai> wrote:
>> No, Plack::Handler::Apache2 compiles the psgi app on the first request and
>> does NOT reload at each request.

> This is great news ! :) So in terms of performance what is the difference
> between running an app under plack::handler::apache2 vs. starman with e.g.
> 10 workers?
> e.g. on http://dancer.1.ai I am running starman 10 workers and on
> http://elephant.1.ai/perl Plack::Handler and while it is difficult to
> benchmark such a simple script it looks like Plack::Handler is at least as
> fast.

I don't understand why it is difficult to benchmark - use apachebench
or jmeter etc. to benchmark your web app. I can't generalize the
performance but i wouldn't also be surprised if Apache2 handler is as
fast.

>  Another question: changes to the plack::handler server script do not
> need a restart (hence some users claimed it was reloading at each request)
> is there something I am missing ?

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 :)

--
Tatsuhiko Miyagawa


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gurugeek  
View profile  
 More options Sep 22 2012, 7:55 pm
From: gurugeek <1...@1.ai>
Date: Sat, 22 Sep 2012 16:55:11 -0700 (PDT)
Local: Sat, Sep 22 2012 7:55 pm
Subject: Re: Plack::Handler::Apache2 in multi hosting vs passenger

> 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

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 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.
Regards
David

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tatsuhiko Miyagawa  
View profile  
 More options Sep 22 2012, 8:01 pm
From: Tatsuhiko Miyagawa <miyag...@gmail.com>
Date: Sun, 23 Sep 2012 09:01:16 +0900
Local: Sat, Sep 22 2012 8:01 pm
Subject: Re: Plack::Handler::Apache2 in multi hosting vs passenger

On Sep 23, 2012, at 8:55 AM, gurugeek <1...@1.ai> wrote:

> 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

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.

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..."

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.

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.
Regards
David

--


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gurugeek  
View profile  
 More options Sep 22 2012, 9:51 pm
From: gurugeek <1...@1.ai>
Date: Sat, 22 Sep 2012 18:51:47 -0700 (PDT)
Local: Sat, Sep 22 2012 9:51 pm
Subject: Re: Plack::Handler::Apache2 in multi hosting vs passenger

>> 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.

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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tatsuhiko Miyagawa  
View profile  
 More options Sep 22 2012, 10:18 pm
From: Tatsuhiko Miyagawa <miyag...@gmail.com>
Date: Sun, 23 Sep 2012 11:18:51 +0900
Local: Sat, Sep 22 2012 10:18 pm
Subject: Re: Plack::Handler::Apache2 in multi hosting vs passenger

On Sep 23, 2012, at 10:51 AM, gurugeek <1...@1.ai> wrote:

>> 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.

If this is the case how does the reload takes place ?

It doesn't take place automatically. You have to restart the httpd process.

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.

As I said that shouldn't happen unless you enable custom reloading with
middleware or you have multiple of workers that somehow don't have the code
compiled.

OR, you configure Plack apache2 handler in a weird way that does things i
can't expect. You haven't showed us your exact configuration yet so we can
only guess.

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 :)

--

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gurugeek  
View profile  
 More options Sep 22 2012, 10:59 pm
From: gurugeek <1...@1.ai>
Date: Sat, 22 Sep 2012 19:59:04 -0700 (PDT)
Local: Sat, Sep 22 2012 10:59 pm
Subject: Re: Plack::Handler::Apache2 in multi hosting vs passenger

I am running apache with the AssignUserID  directive and a the standard
configuration without any tweaking      

  <Location /perl>
            SetHandler perl-script
            PerlHandler Plack::Handler::Apache2
            PerlSetVar psgi_app /home/ai_elephant/www/perl/bin/app.pl
         </Location>

+ prefork and MPM as a main configuration (and pretty much standard without
any tweaking)

just edited live  

and the changes took effect when I reloaded the page
I am actually not complaining about the auto-reload which is, in fact, very
useful. So this is just FYI. Thank you
David

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tatsuhiko Miyagawa  
View profile  
 More options Sep 22 2012, 11:55 pm
From: Tatsuhiko Miyagawa <miyag...@gmail.com>
Date: Sun, 23 Sep 2012 12:55:12 +0900
Local: Sat, Sep 22 2012 11:55 pm
Subject: Re: Plack::Handler::Apache2 in multi hosting vs passenger

That configuration doesn't seem to reload your app. You can look at the
handler module code which is like 50 lines of code you can see the app is
cached off of a file name.

Your app getting reloaded is a mystery or some bug or misconfiguration.

Sent from my iPhone

On Sep 23, 2012, at 11:59 AM, gurugeek <1...@1.ai> wrote:

I am running apache with the AssignUserID  directive and a the standard
configuration without any tweaking

  <Location /perl>
            SetHandler perl-script
            PerlHandler Plack::Handler::Apache2
            PerlSetVar psgi_app /home/ai_elephant/www/perl/bin/app.pl
         </Location>

+ prefork and MPM as a main configuration (and pretty much standard without
any tweaking)

just edited live

and the changes took effect when I reloaded the page
I am actually not complaining about the auto-reload which is, in fact, very
useful. So this is just FYI. Thank you
David

--


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »