mod_perl and mass virtual hosting

mod_perl and mass virtual hosting

am 27.05.2010 21:36:01 von Joshua Johnson

--00163641745125816f048798805d
Content-Type: text/plain; charset=ISO-8859-1

Hello all,

I have a question on using mod_perl to configure apache for many virtual
hosts. My problem is the high load on the apache server. I decided to go
with mod_perl to configure apache and here are the reasons (if I should be
doing this a different way, please say so. I'm open to suggestions).:

The company I work at has ~13,000 customer domains. There is a database
where these domains are configured. Some of them are "standard" packages and
simply have a document root where customers upload pages. Some of the
domains make proxy requests to another site. And still others make a proxied
rewrite from "/" to "some random url that is stored in the db". Some
redirect to another url. There are about 20 other such configurations.

I used mod_perl to load all of this up at startup and it worked beautifully.
I originally thought that I would be able to dynamically setup VirtuaHost
sections as requests came in for domains (maybe they were freshly added to
the db or the record updated). But I found you can't really do that so I
have to restart for changes to take effect. Either way, I'm very happy with
how easy and clean mod_perl has made all of this.

But the load on apache runs anywhere from 0.50 to 3.00 on a dual cpu server.
Response doesn't seem slow (except for right after an apache restart) but
I'm worried that I'm doing something fundamentally wrong. There is a
significant amount of proxying going on so I set "ProxyReceiveBufferSize
16384" but that doesn't seem to have changed too much. Could mod_perl be the
cause of the load or would it be the end apache config? Are there any
initial thoughts anyone has? Has anyone run into something similar? Should I
be going about this a different way?

Related: and would it be possible to add config on-the-fly? $r->add_config()
Won't let you add VirtualHosts because it operates as though in a
directive.

I guess I'm just looking for thoughts in general. I've been tinkering with
this for about 2 weeks now.

Thanks,
Josh J

--00163641745125816f048798805d
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello all,


I have a question on using mod=
_perl to configure apache for many virtual hosts. My problem is the high lo=
ad on the apache server. I decided to go with mod_perl to configure apache =
and here are the reasons (if I should be doing this a different way, please=
say so. I'm open to suggestions).:



The company I work at has ~13,000 customer domains. There is a database=
where these domains are configured. Some of them are "standard" =
packages and simply have a document root where customers upload pages. Some=
of the domains make proxy requests to another site. And still others make =
a proxied rewrite from "/" to "some random url that is store=
d in the db". Some redirect to another url. There are about 20 other s=
uch configurations.



I used mod_perl to load all of this up at startup and it worked beautif=
ully. I originally thought that I would be able to dynamically setup Virtua=
Host sections as requests came in for domains (maybe they were freshly adde=
d to the db or the record updated). But I found you can't really do tha=
t so I have to restart for changes to take effect. Either way, I'm very=
happy with how easy and clean mod_perl has made all of this.



But the load on apache runs anywhere from 0.50 to 3.00 on a dual cpu se=
rver. Response doesn't seem slow (except for right after an apache rest=
art) but I'm worried that I'm doing something fundamentally wrong. =
There is a significant amount of proxying going on so I set "ProxyRece=
iveBufferSize 16384" but that doesn't seem to have changed too muc=
h. Could mod_perl be the cause of the load or would it be the end apache co=
nfig? Are there any initial thoughts anyone has? Has anyone run into someth=
ing similar? Should I be going about this a different way?



Related: and would it be possible to add config on-the-fly? $r->add_=
config() Won't let you add VirtualHosts because it operates as though i=
n a <Location> directive.

I guess I'm just looking for tho=
ughts in general. I've been tinkering with this for about 2 weeks now.<=
br>


Thanks,
Josh J




--00163641745125816f048798805d--

Re: mod_perl and mass virtual hosting

am 27.05.2010 21:39:56 von Fred Moyer

It sounds like you are using mod_perl and mod_proxy on the same main
httpd, is that right?

If so, consider running another front end proxy such as apache with
the event_mpm, perlbal, ha_proxy, or nginx. Without having more
details (Devel::NYT::Prof may provide some), my guess is that you are
blocking on child httpds in mod_proxy.

On Thu, May 27, 2010 at 12:36 PM, Joshua Johnson
wrote:
> Hello all,
>
> I have a question on using mod_perl to configure apache for many virtual
> hosts. My problem is the high load on the apache server. I decided to go
> with mod_perl to configure apache and here are the reasons (if I should be
> doing this a different way, please say so. I'm open to suggestions).:
>
> The company I work at has ~13,000 customer domains. There is a database
> where these domains are configured. Some of them are "standard" packages and
> simply have a document root where customers upload pages. Some of the
> domains make proxy requests to another site. And still others make a proxied
> rewrite from "/" to "some random url that is stored in the db". Some
> redirect to another url. There are about 20 other such configurations.
>
> I used mod_perl to load all of this up at startup and it worked beautifully.
> I originally thought that I would be able to dynamically setup VirtuaHost
> sections as requests came in for domains (maybe they were freshly added to
> the db or the record updated). But I found you can't really do that so I
> have to restart for changes to take effect. Either way, I'm very happy with
> how easy and clean mod_perl has made all of this.
>
> But the load on apache runs anywhere from 0.50 to 3.00 on a dual cpu server.
> Response doesn't seem slow (except for right after an apache restart) but
> I'm worried that I'm doing something fundamentally wrong. There is a
> significant amount of proxying going on so I set "ProxyReceiveBufferSize
> 16384" but that doesn't seem to have changed too much. Could mod_perl be the
> cause of the load or would it be the end apache config? Are there any
> initial thoughts anyone has? Has anyone run into something similar? Should I
> be going about this a different way?
>
> Related: and would it be possible to add config on-the-fly? $r->add_config()
> Won't let you add VirtualHosts because it operates as though in a
> directive.
>
> I guess I'm just looking for thoughts in general. I've been tinkering with
> this for about 2 weeks now.
>
> Thanks,
> Josh J
>
>

Re: mod_perl and mass virtual hosting

am 27.05.2010 22:02:25 von Perrin Harkins

I second what Fred said. Also, you might consider just generating a
config file for apache with perl and not running mod_perl in the
server. I try to avoid using mod_perl for things that mod_rewrite and
mod_proxy can handle.

- Perrin

On Thu, May 27, 2010 at 3:39 PM, Fred Moyer wrote:
> It sounds like you are using mod_perl and mod_proxy on the same main
> httpd, is that right?
>
> If so, consider running another front end proxy such as apache with
> the event_mpm, perlbal, ha_proxy, or nginx. =A0Without having more
> details (Devel::NYT::Prof may provide some), my guess is that you are
> blocking on child httpds in mod_proxy.
>
> On Thu, May 27, 2010 at 12:36 PM, Joshua Johnson
> wrote:
>> Hello all,
>>
>> I have a question on using mod_perl to configure apache for many virtual
>> hosts. My problem is the high load on the apache server. I decided to go
>> with mod_perl to configure apache and here are the reasons (if I should =
be
>> doing this a different way, please say so. I'm open to suggestions).:
>>
>> The company I work at has ~13,000 customer domains. There is a database
>> where these domains are configured. Some of them are "standard" packages=
and
>> simply have a document root where customers upload pages. Some of the
>> domains make proxy requests to another site. And still others make a pro=
xied
>> rewrite from "/" to "some random url that is stored in the db". Some
>> redirect to another url. There are about 20 other such configurations.
>>
>> I used mod_perl to load all of this up at startup and it worked beautifu=
lly.
>> I originally thought that I would be able to dynamically setup VirtuaHos=
t
>> sections as requests came in for domains (maybe they were freshly added =
to
>> the db or the record updated). But I found you can't really do that so I
>> have to restart for changes to take effect. Either way, I'm very happy w=
ith
>> how easy and clean mod_perl has made all of this.
>>
>> But the load on apache runs anywhere from 0.50 to 3.00 on a dual cpu ser=
ver.
>> Response doesn't seem slow (except for right after an apache restart) bu=
t
>> I'm worried that I'm doing something fundamentally wrong. There is a
>> significant amount of proxying going on so I set "ProxyReceiveBufferSize
>> 16384" but that doesn't seem to have changed too much. Could mod_perl be=
the
>> cause of the load or would it be the end apache config? Are there any
>> initial thoughts anyone has? Has anyone run into something similar? Shou=
ld I
>> be going about this a different way?
>>
>> Related: and would it be possible to add config on-the-fly? $r->add_conf=
ig()
>> Won't let you add VirtualHosts because it operates as though in a ion>
>> directive.
>>
>> I guess I'm just looking for thoughts in general. I've been tinkering wi=
th
>> this for about 2 weeks now.
>>
>> Thanks,
>> Josh J
>>
>>
>

Re: mod_perl and mass virtual hosting

am 27.05.2010 22:05:16 von torsten.foertsch

On Thursday 27 May 2010 21:36:01 Joshua Johnson wrote:
> Related: and would it be possible to add config on-the-fly?
> $r->add_config() Won't let you add VirtualHosts because it operates as
> though in a directive.
>=20
I do most of the request config with $r->add_config(). The httpd.conf conta=
ins=20
2 Vhosts per IP, 1 plain, 1 SSL. At runtime the Host HTTP header then decid=
es=20
what to do. This resembles very much name based vhosts without actually hav=
ing=20
vhosts. On the positive side one can add "vhosts" without restarting apache=
,=20
on the negative there is only one error_log/access_log. The access_log can =
be=20
splitted afterwards if the Host header is logged. I actually log to named=20
pipes. The web server runs inside a chroot, the log reader outside.

Torsten Förtsch

=2D-=20
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net

Re: mod_perl and mass virtual hosting

am 27.05.2010 22:23:17 von Joshua Johnson

--001636498d172a4070048799291d
Content-Type: text/plain; charset=ISO-8859-1

Fred,

Yes, mod_perl and mod_proxy are on the same httpd.

Perrin,

For clarification, I'm using sections to create the config from info
stored in various databases but mod_rewrite and mod_proxy are doing the real
work. There are no Perl Handlers.

I think I will try writing out the config and see if that changes the load
at all and then start going into your suggestions, Fred, and try going
through another front end proxy. Don't want to introduce too many variables
at the same time.

Thanks for the suggestions, guys.
-Josh J

On Thu, May 27, 2010 at 4:02 PM, Perrin Harkins wrote:

> I second what Fred said. Also, you might consider just generating a
> config file for apache with perl and not running mod_perl in the
> server. I try to avoid using mod_perl for things that mod_rewrite and
> mod_proxy can handle.
>
> - Perrin
>
> On Thu, May 27, 2010 at 3:39 PM, Fred Moyer
> wrote:
> > It sounds like you are using mod_perl and mod_proxy on the same main
> > httpd, is that right?
> >
> > If so, consider running another front end proxy such as apache with
> > the event_mpm, perlbal, ha_proxy, or nginx. Without having more
> > details (Devel::NYT::Prof may provide some), my guess is that you are
> > blocking on child httpds in mod_proxy.
> >
> > On Thu, May 27, 2010 at 12:36 PM, Joshua Johnson
> > wrote:
> >> Hello all,
> >>
> >> I have a question on using mod_perl to configure apache for many virtual
> >> hosts. My problem is the high load on the apache server. I decided to go
> >> with mod_perl to configure apache and here are the reasons (if I should
> be
> >> doing this a different way, please say so. I'm open to suggestions).:
> >>
> >> The company I work at has ~13,000 customer domains. There is a database
> >> where these domains are configured. Some of them are "standard" packages
> and
> >> simply have a document root where customers upload pages. Some of the
> >> domains make proxy requests to another site. And still others make a
> proxied
> >> rewrite from "/" to "some random url that is stored in the db". Some
> >> redirect to another url. There are about 20 other such configurations.
> >>
> >> I used mod_perl to load all of this up at startup and it worked
> beautifully.
> >> I originally thought that I would be able to dynamically setup
> VirtuaHost
> >> sections as requests came in for domains (maybe they were freshly added
> to
> >> the db or the record updated). But I found you can't really do that so I
> >> have to restart for changes to take effect. Either way, I'm very happy
> with
> >> how easy and clean mod_perl has made all of this.
> >>
> >> But the load on apache runs anywhere from 0.50 to 3.00 on a dual cpu
> server.
> >> Response doesn't seem slow (except for right after an apache restart)
> but
> >> I'm worried that I'm doing something fundamentally wrong. There is a
> >> significant amount of proxying going on so I set "ProxyReceiveBufferSize
> >> 16384" but that doesn't seem to have changed too much. Could mod_perl be
> the
> >> cause of the load or would it be the end apache config? Are there any
> >> initial thoughts anyone has? Has anyone run into something similar?
> Should I
> >> be going about this a different way?
> >>
> >> Related: and would it be possible to add config on-the-fly?
> $r->add_config()
> >> Won't let you add VirtualHosts because it operates as though in a
>
> >> directive.
> >>
> >> I guess I'm just looking for thoughts in general. I've been tinkering
> with
> >> this for about 2 weeks now.
> >>
> >> Thanks,
> >> Josh J
> >>
> >>
> >
>

--001636498d172a4070048799291d
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Fred,





Yes, mod_perl and mod_proxy are on the same httpd.





Perrin,





For clarification, I'm using <Perl> sections to create the config=
=20
from info stored in various databases but mod_rewrite and mod_proxy are=20
doing the real work. There are no Perl Handlers.

I think I will try =
writing out the config and see if that changes the load at all and then sta=
rt going into your suggestions, Fred, and try going through another front e=
nd proxy. Don't want to introduce too many variables at the same time.<=
br>

Thanks for the suggestions, guys.
-Josh J

_quote">On Thu, May 27, 2010 at 4:02 PM, Perrin Harkins &=
lt;>
wrote:=


r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">I second what Fre=
d said. =A0Also, you might consider just generating a

config file for apache with perl and not running mod_perl in the

server. =A0I try to avoid using mod_perl for things that mod_rewrite and >
mod_proxy can handle.



- Perrin



On Thu, May 27, 2010 at 3:39 PM, Fred Moyer < otpenguin.com">fred@redhotpenguin.com> wrote:

> It sounds like you are using mod_perl and mod_proxy on the same main r>
> httpd, is that right?

>

> If so, consider running another front end proxy such as apache with >
> the event_mpm, perlbal, ha_proxy, or nginx. =A0Without having more

> details (Devel::NYT::Prof may provide some), my guess is that you are<=
br>
> blocking on child httpds in mod_proxy.

>

> On Thu, May 27, 2010 at 12:36 PM, Joshua Johnson

> <joshpauljohnson@gmail=
..com
> wrote:

>> Hello all,

>>

>> I have a question on using mod_perl to configure apache for many v=
irtual

>> hosts. My problem is the high load on the apache server. I decided=
to go

>> with mod_perl to configure apache and here are the reasons (if I s=
hould be

>> doing this a different way, please say so. I'm open to suggest=
ions).:

>>

>> The company I work at has ~13,000 customer domains. There is a dat=
abase

>> where these domains are configured. Some of them are "standar=
d" packages and

>> simply have a document root where customers upload pages. Some of =
the

>> domains make proxy requests to another site. And still others make=
a proxied

>> rewrite from "/" to "some random url that is stored=
in the db". Some

>> redirect to another url. There are about 20 other such configurati=
ons.

>>

>> I used mod_perl to load all of this up at startup and it worked be=
autifully.

>> I originally thought that I would be able to dynamically setup Vir=
tuaHost

>> sections as requests came in for domains (maybe they were freshly =
added to

>> the db or the record updated). But I found you can't really do=
that so I

>> have to restart for changes to take effect. Either way, I'm ve=
ry happy with

>> how easy and clean mod_perl has made all of this.

>>

>> But the load on apache runs anywhere from 0.50 to 3.00 on a dual c=
pu server.

>> Response doesn't seem slow (except for right after an apache r=
estart) but

>> I'm worried that I'm doing something fundamentally wrong. =
There is a

>> significant amount of proxying going on so I set "ProxyReceiv=
eBufferSize

>> 16384" but that doesn't seem to have changed too much. Co=
uld mod_perl be the

>> cause of the load or would it be the end apache config? Are there =
any

>> initial thoughts anyone has? Has anyone run into something similar=
? Should I

>> be going about this a different way?

>>

>> Related: and would it be possible to add config on-the-fly? $r->=
;add_config()

>> Won't let you add VirtualHosts because it operates as though i=
n a <Location>

>> directive.

>>

>> I guess I'm just looking for thoughts in general. I've bee=
n tinkering with

>> this for about 2 weeks now.

>>

>> Thanks,

>> Josh J

>>

>>

>




--001636498d172a4070048799291d--