I have a web farm that uses Apache 2.2.15 and mod_perl-2.0.4. I need to know if there is a comparable perl module to Apache::GTopLimit
for mod_perl-2.x.
I have searched Google and other sites, and have not found anything yet. What I need to do is limit the amount of memory any one worker can consume. If it exceeds the threshold, then I want the worker to die.
I have already set the MaxRequestsPerChild
value, but that does not prevent a worker from eating up all the memory on the box.
If you've got Apache worker processes running away with all your memory in mod_perl, you've probably got bigger issues with your underlying application code. You shouldn't need to be cycling Apache workers that manually, unless your ratio of requests to workers is very low - in which case, adjusting that ratio by decreasing the number of workers might help with your issue.
All that aside, is there anything stopping you from just
apachectl graceful
-ing Apache every n hours? This terminates all the existing Apache workers as soon as they become idle, spawns new ones; it's a very direct-action approach to managing the worker processes, if fixing the underlying mod_perl issue isn't an option.For workers that are separate process,
ulimit
would work at stopping their memory growth.