Apache::GTopLimit

Limit Apache httpd processes
Download

Apache::GTopLimit Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Stas Bekman
  • Publisher web site:
  • http://search.cpan.org/~stas/

Apache::GTopLimit Tags


Apache::GTopLimit Description

Limit Apache httpd processes Apache::GTopLimit is a Perl module that will run on platforms supported by GTop.pm a Perl interface to libgtop (which in turn needs libgtop).This module was written in response to questions on the mod_perl mailing list on how to tell the httpd process to exit if:* its memory size goes beyond a specified limit* its shared memory size goes below a specified limit* its unshared memory size goes beyond a specified limitSYNOPSISThis module allows you to kill off Apache httpd processes if they grow too large or have too little of shared memory. You can choose to set up the process size limiter to check the process size on every request: # in your startup.pl: # ___________________ use Apache::GTopLimit; # Control the life based on memory size # in KB, so this is ~10MB $Apache::GTopLimit::MAX_PROCESS_SIZE = 10000; # Control the life based on Shared memory size # in KB, so this is ~4MB $Apache::GTopLimit::MIN_PROCESS_SHARED_SIZE = 4000; # Control the life based on UnShared memory size # in KB, so this is ~6MB $Apache::GTopLimit::MAX_PROCESS_UNSHARED_SIZE = 6000; # in your httpd.conf: # ___________________ # debug mode must be set before the module is loaded PerlSetVar Apache::GTopLimit::DEBUG 1 # register handler PerlFixupHandler Apache::GTopLimit # you can set this up as any Perl*Handler that handles # part of the request, even the LogHandler will do.Or you can just check those requests that are likely to get big or unshared. This way of checking is also easier for those who are mostly just running Apache::Registry scripts: # in your handler/CGI script use Apache::GTopLimit; # Max Process Size in KB Apache::GTopLimit->set_max_size(10000); and/or use Apache::GTopLimit; # Min Shared process Size in KB Apache::GTopLimit->set_min_shared_size(4000);and/or use Apache::GTopLimit; # Min UnShared process Size in KB Apache::GTopLimit->set_max_unshared_size(6000);Since accessing the process info might add a little overhead, you may want to only check the process size every N times. To do so, put this in your startup.pl or CGI: $Apache::GTopLimit::CHECK_EVERY_N_REQUESTS = 2;This will only check the process size every other time the process size checker is called.Note: The MAX_PROCESS_SIZE, MIN_PROCESS_SHARED_SIZE and MAX_PROCESS_UNSHARED_SIZE are independent, and each will be checked if only set. So if you set the first two -- the process can be killed if it grows beyond the limit or its shared memory goes below the limit. It's better not to mix MAX_PROCESS_UNSHARED_SIZE with the first two. Requirements: · Perl


Apache::GTopLimit Related Software