You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Greg Stark <gs...@mit.edu> on 2000/09/02 04:16:48 UTC

Re: Apache::Reload 0.04

Stas Bekman <st...@stason.org> writes:

> But adds an additional stat() call for each request, which might be not
> desired for "some" sites... I know it's quite fast. See:
> http://thingy.kcilink.com/modperlguide/performance/Reducing_the_Number_of_stat_Ca.html
> 
> But, yeah it's cool!

In practice I find that stat calls are a minor performance factor when
compared with database calls so for any fairly dynamic site it's not a big
factor.

However, perhaps a better tradeoff for a production site would be to perform
these stat calls in the parent just before a graceful restart. Then to force
rereading the library files without any downtime the you would just do a
graceful restart, which would recompile all the .pm files and then start
spawning new children with optimal shared memory behaviour:)

I believe Apache::ASP's internal mechanism is capable of this now. 

-- 
greg


Re: Apache::Reload 0.04

Posted by Joshua Chamas <jo...@chamas.com>.
Greg Stark wrote:
> 
> Stas Bekman <st...@stason.org> writes:
> 
> > But adds an additional stat() call for each request, which might be not
> > desired for "some" sites... I know it's quite fast. See:
> > http://thingy.kcilink.com/modperlguide/performance/Reducing_the_Number_of_stat_Ca.html
> >
> > But, yeah it's cool!
> 
> In practice I find that stat calls are a minor performance factor when
> compared with database calls so for any fairly dynamic site it's not a big
> factor.
> 
> However, perhaps a better tradeoff for a production site would be to perform
> these stat calls in the parent just before a graceful restart. Then to force
> rereading the library files without any downtime the you would just do a
> graceful restart, which would recompile all the .pm files and then start
> spawning new children with optimal shared memory behaviour:)
> 
> I believe Apache::ASP's internal mechanism is capable of this now.
> 

Yes, to have Apache::ASP reload scripts and libraries just at
restart, for normal scripts config do:

  PerlSetVar StatScripts 0
  PerlSetVar StatINC 0      # default

Then for a perl restart handler, register a sub which 
calls Loader()

sub restart {
  Apache::ASP->Loader(
	'/path/to/scripts/', '\.asp$|$other_pattern_match'
	StatINC => 1,
	%OtherConfigs
	);
}

This will make your web site only change upon server 
graceful restart, and saves some stat() calls.

The StatINC mechanism is similar to what is provided
by Apache::Reload and Apache::StatINC.

Note that I would not use this method much, as the
restart handler last I checked seems to leak 1M RAM
for each graceful, but this is a nicer way to republish
your web site than doing a hard stop/start

-- Joshua

_________________________________________________________________
Joshua Chamas			        Chamas Enterprises Inc.
NodeWorks >> free web link monitoring	Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

Re: Apache::Reload 0.04

Posted by Stas Bekman <st...@stason.org>.
> Stas Bekman <st...@stason.org> writes:
> 
> > But adds an additional stat() call for each request, which might be not
> > desired for "some" sites... I know it's quite fast. See:
> > http://thingy.kcilink.com/modperlguide/performance/Reducing_the_Number_of_stat_Ca.html
> > 
> > But, yeah it's cool!
> 
> In practice I find that stat calls are a minor performance factor when
> compared with database calls so for any fairly dynamic site it's not a big
> factor.
> 
> However, perhaps a better tradeoff for a production site would be to perform
> these stat calls in the parent just before a graceful restart. Then to force
> rereading the library files without any downtime the you would just do a
> graceful restart, which would recompile all the .pm files and then start
> spawning new children with optimal shared memory behaviour:)
> 
> I believe Apache::ASP's internal mechanism is capable of this now. 

That's what PerlFreshRestart was written for. But as the current state
goes it's deprecated since many people has reported segfaults with it (at
least for those who has this problem). Otherwise it does just like what
you have described above, without any relation to Apache::Reload.

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide 
mailto:stas@stason.org   http://apachetoday.com http://jazzvalley.com
http://singlesheaven.com http://perlmonth.com   perl.org   apache.org