<?xml version="1.0" encoding="windows-1252"?>
<node id="998760" title="Re: Forcing modperl processes to restart after N requests" created="2012-10-12 14:03:12" updated="2012-10-12 14:03:12">
<type id="11">
note</type>
<author id="840342">
McA</author>
<data>
<field name="doctext">
&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Look at http://perl.apache.org/docs/1.0/guide/performance.html#Measuring_the_Memory_of_the_Process for some hints on memory usage.&lt;/p&gt;
&lt;p&gt;Look for documentation of &lt;code&gt;$r-&gt;child_terminate&lt;/code&gt;. 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).&lt;/p&gt;
&lt;p&gt;Best regards&lt;br/&gt;
McA&lt;/p&gt;
&lt;p&gt;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/)&lt;/p&gt;</field>
<field name="root_node">
998686</field>
<field name="parent_node">
998686</field>
</data>
</node>
