[KLUG Members] Apache: Limit the amount of RAM used by a child/altogether.

Jamie McCarthy members@kalamazoolinux.org
Fri, 10 Oct 2003 09:15:09 -0400


adam@morrison-ind.com (Adam Williams) writes:

> > For Slashdot, we dropped this in our httpd.conf:
> >     <Perl>
> >     use Apache::SizeLimit;
> >     $Apache::SizeLimit::MAX_PROCESS_SIZE = 75000;
> >     $Apache::SizeLimit::MAX_UNSHARED_SIZE = 75000;
> >     </Perl>
> >     PerlFixupHandler Apache::SizeLimit
> 
> Does this work for all apache threads or just ones directly
> involving executing stuff in the context of mod_perl?

If that handler gets called, it does its thing;  so it would depend
on where in the .conf files you put the PerlFixupHandler directive.
In our case it runs after every page.

> > Also, of course, it only works if you already have mod_perl
> > compiled in;  if not, adding it is surely more bloat than
> > this is worth. Do 'perldoc Apache::SizeLimit' for info.
> 
> Did you try just making ulimit calls in /etc/rc.d/init.d/httpd
> (or your distor's equivalend)?

No;  in our case, if an Apache child gets big, we still want the
processing to continue and the page to be delivered properly.  We
only want to retire it afterwards.  So having the OS set hard limits
isn't the solution we wanted.

Like I said, this solves a slightly different problem than the one
the original poster asked about, but I figured I'd throw it out
there anyway...
-- 
  Jamie McCarthy
 http://mccarthy.vg/
  jamie@mccarthy.vg