Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Forcing modperl processes to restart after N requests

by McA (Priest)
on Oct 12, 2012 at 18:03 UTC ( #998760=note: print w/replies, xml ) Need Help??


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/)

Replies are listed 'Best First'.
Re^2: Forcing modperl processes to restart after N requests
by alain_desilets (Beadle) on Oct 12, 2012 at 19:57 UTC

    Sounds like MaxRequestsPerChild is what I need. Thx.

    Strangely enough, I didn't come across it, even after 30 mins of google for things like "mod_perl forcing process to restart".

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://998760]
help
Chatterbox?
[shmem]: that's why it is called "Windows"
[stevieb]: shmem thanks for the 'insight' :P
[shmem]: good thing that Sun already took "OpenWindows", otherwise I'd not stop to shudder imagining an "OpenWindows" from MS
[shmem]: more garbage in, more garbage out that would be
[stevieb]: I found that win10 broke a C# library I was using for one project while enhancing tests for a Perl dist, which breaks other Perl dists, and I'm about to throw my hands up on berrybrew. win2k12 broke one thing, win10 breaks something...
[stevieb]: ...unrelated which requires replacing a lot of code and a whole lib. I'm about to go nix only ffs
[shmem]: stevieb: what you're doing sounds afwully complex. Too much for me this evening to provide brighter insight ;-)
[stevieb]: I don't even own a Windows computer. Both my girl and I have a laptop each with Linux. I'm supporting Windows in some of my projects and I can't even guage whether it's worth it or not.
[stevieb]: shmem It's something I desired to have years ago, which is why I took over berrybrew. Cross-platform build/test automation locally, or over the network Test::BrewBuild

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2017-03-28 22:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (342 votes). Check out past polls.