Re: Terminating Child process Dynamically
André Warnier <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
> On Fri, Mar 2, 2012 at 3:32 PM, André Warnier <[email protected]> wrote: > >> Shibi Ns wrote: >> >>> I would like terminate current sever Child process after the end of >>> current request because some data is cached and data is changed after the >>> process creation. The data cached during InitChild phase >>> >>> Is it possible ? >>> >>> It is certainly possible (*), but really, really, really inefficient. >> You are going to force your Apache server to create a new child process >> for each HTTP request ? That sounds crazy. >> You should review your application logic instead. >> >> >> (*) The easiest way would be to set MaxRequestsPerChild to 1 in your >> server configuration. >> But don't think that I would recommend doing that. >> > Shibi Ns wrote: > Not each request , it's based some data change in database and this could > happen couple of times in day that's all. We really don't want to go ahead > bounce the application in order refresh the cache > I don't now what you mean by "bounce the application", but why do you not do something like this : At the beginning of your first "handler" : our $CACHED_DATA; unless (defined $CACHED_DATA) { $CACHED_DATA = _load_cached_data(); } .... within the request processing : our $CACHED_DATA; if ($condition) { $CACHED_DATA = undef; } return OK; ... sub _load_cached_data { # load and cache whatever data needs be my $cached_data; ... return $cached_data; }