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

Adam Williams members@kalamazoolinux.org
Wed, 08 Oct 2003 21:41:13 -0400


> Got a quick question for you all.  I've got a couple of web  servers that 
> are running a program called 'WebGUI'.  

Maybe a URL to what exactly this is?

> It's a slick program, but unfortunately, certain mistakes allow apache to 
> run away with itself; it uses up all the CPU and RAM, crashing the server 
> post-haste.

Does it run inside some module (PHP, Python, Tomcat, etc...)?  Usually
these modules have thier own discrete mechansims for throttling resource
consumption.

> I've been googling for some time and can't find a decent way to limit the 
> amount of ram that apache can use.  I've found a few things like 
> RLimitMEM, RLimitNPROC, etc. BUt they don't work; I can use up all my ram 
> no sweat with a single process.

You mean ulimits?  Ah,  I see what your using, they are directives from
http_core....  I'd wager these directives manifest as a call to
setrlimit.  Under 2.4 only the parameters ru_utime, ru_stime, ru_minflt,
ru_majflt, and ru_nswap are enforced.  (man setrlimit, please).  Could
this be the cause of the "don't work" that your seeing?

If someone is passing through PAM at some point you can use the limits
module to create a resource cage -
http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/pam-6.html#ss6.12