> Thanks so much for the tips.  I got Apache::VMonitor - awesome package, Stas
> - and investigated it further.  What I found was that each child loses a
> small amount of shared memory during normal use, due to copy-on-write.  In
> my case from about 12M to 9M (roughly 25%).  But it stabilizes at 9M shared,
> and then all of a sudden *all* of the child processes + the parent drop to
> 3M shared.  All of them at once.

Is it a single script/handler you are testing with? 

*all* children at once? You mean you do a single request and it happens?
The only reason I can think of is parent dirtying its memory pages,
however I cannot think about a possible way to do this...

> Could this be due to swapping?  (my site is currently very low traffic)  I
> did notice that I could not actively cause the shared memory to dip below
> 9M.  I had to wait a few minutes, and reload VMonitor after a period of no
> activity.
> 
> I couldn't test exiting the Apache child, since it isn't a gradual
> dropoff. BTW, how do you terminate an Apache child process from within
> mod_perl? 

CORE::exit(0) to kill it in the middle of request (better not do that).

To exit upon request completion 
my $r = shift;
$r->post_connection(\&exit_child);
sub exit_child{
  # some logic here if needed
  $r->child_terminate;
}

I think you actually want to take a look at Apache::GTopLimit module,
which allows you to terminate processes based on sizes of shared memory
and normal memory. It'll enter the mod_perl dist 1.22, meanwhile you can
get it by downloading the CVS snapshot from the site.

> Thanks,
> - Adi
> 
> Randy Harmon wrote:
> > 
> > On Wed, Oct 20, 1999 at 10:47:02PM -0700, Adi wrote:
> > > > On Wed, 20 Oct 1999, Remi Fasol wrote:
> > > Does anyone know why the shared memory would decrease so dramatically?
> > 
> > Perl code and data both live in the data segment.  As it is used, any time
> > it writes information into a new chunk of memory, the memory is
> > copied-on-write, becoming not-shared.
> > 
> > You may or may not benefit from exiting your Apache child when its shared
> > memory size shrinks too much.  I think a package of Stas Bekman's
> > authorship may help you detect that occasion.  It wraps the gtop library in
> > perl, so you can monitor 'top' info from mod_perl.
> > 
> > Your own tests will give you an indication of whether this saves memory and
> > should also indicate whether there is any performance advantage one way or
> > other.
> > 
> > It'd be interesting to hear your story of the results.
> > 
> > Randy
> 
> 



_______________________________________________________________________
Stas Bekman  mailto:[EMAIL PROTECTED]    www.singlesheaven.com/stas  
Perl,CGI,Apache,Linux,Web,Java,PC at  www.singlesheaven.com/stas/TULARC
www.apache.org  & www.perl.com  == www.modperl.com  ||  perl.apache.org
single o-> + single o-+ = singlesheaven    http://www.singlesheaven.com

Reply via email to