http://www.perlmonks.org?node_id=998760


in reply to Forcing modperl processes to restart after N requests

Hi!

The simplest solution is to let Apache handle it: There is a configuration parameter MaxRequestsPerChild. On default installations it's set relativly high. Tweak it for you mod_perl centric processes.

Look at http://perl.apache.org/docs/1.0/guide/performance.html#Measuring_the_Memory_of_the_Process for some hints on memory usage.

Look for documentation of $r->child_terminate. With that method you can force the Apache child to exit gracefully at the end of the whole request lifetime. Combined with a process global counter you could implement an own controlled way of exiting after an certain count of requests. With this way you could be sure that a certain amount of perl handled requests were served (using Apache for static and dynamic content).

Best regards
McA

P.S.: mod_perl mailing list is the right target for these questions. Thorsten Förtsch regularly answer fast and very competent. (http://foertsch.name/)