cvs commit: modperl/lib/Apache SizeLimit.pm

2002-03-13 Thread stas

stas02/03/13 21:27:44

  Modified:lib/Apache SizeLimit.pm
  Log:
  - the parent process doesn't get killed if it's big, so correct the note
  not to say exiting...
  
  Revision  ChangesPath
  1.9   +1 -1  modperl/lib/Apache/SizeLimit.pm
  
  Index: SizeLimit.pm
  ===
  RCS file: /home/cvs/modperl/lib/Apache/SizeLimit.pm,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SizeLimit.pm  6 Jul 2001 13:44:39 -   1.8
  +++ SizeLimit.pm  14 Mar 2002 05:27:43 -  1.9
   -227,7 +227,7 
$r-child_terminate;
   
} else {# this is the main httpd, whose parent is init?
  - my $msg = main process too big, exiting at SIZE=$size KB ;
  + my $msg = main process too big, SIZE=$size KB ;
$msg .=  SHARE=$share KB if ($share);
error_log($msg);
}
  
  
  



cvs commit: modperl/lib/Apache SizeLimit.pm

2001-07-06 Thread dougm

dougm   01/07/06 06:44:41

  Modified:.Changes
   lib/Apache SizeLimit.pm
  Log:
  Apache::SizeLimit enhancements [Perrin Harkins [EMAIL PROTECTED]]:
  - Added support for minimum shared memory and maximum unshared memory
  settings.
  - Added extra diagnostics to tell how many requests a process served,
  how long it lived, and how much shared memory it was using when
  SizeLimit killed it.
  
  Revision  ChangesPath
  1.602 +7 -0  modperl/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.601
  retrieving revision 1.602
  diff -u -r1.601 -r1.602
  --- Changes   2001/06/21 16:11:40 1.601
  +++ Changes   2001/07/06 13:44:34 1.602
  @@ -10,6 +10,13 @@
   
   =item 1.25_01-dev
   
  +Apache::SizeLimit enhancements [Perrin Harkins [EMAIL PROTECTED]]:
  +- Added support for minimum shared memory and maximum unshared memory
  +settings.
  +- Added extra diagnostics to tell how many requests a process served,
  +how long it lived, and how much shared memory it was using when
  +SizeLimit killed it.
  +
   win32 enhancement: APACHE_SRC can be either the build or install tree
   [Randy Kobes [EMAIL PROTECTED]]
   
  
  
  
  1.8   +81 -24modperl/lib/Apache/SizeLimit.pm
  
  Index: SizeLimit.pm
  ===
  RCS file: /home/cvs/modperl/lib/Apache/SizeLimit.pm,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SizeLimit.pm  2000/12/20 18:51:56 1.7
  +++ SizeLimit.pm  2001/07/06 13:44:39 1.8
  @@ -12,7 +12,10 @@
   
   # in your startup.pl:
   use Apache::SizeLimit;
  -$Apache::SizeLimit::MAX_PROCESS_SIZE = 1; # in KB, so this is 10MB
  +# sizes are in KB
  +$Apache::SizeLimit::MAX_PROCESS_SIZE  = 1; # 10MB
  +$Apache::SizeLimit::MIN_SHARE_SIZE= 1000;  # 1MB
  +$Apache::SizeLimit::MAX_UNSHARED_SIZE = 12000; # 12MB
   
   # in your httpd.conf:
   PerlFixupHandler Apache::SizeLimit
  @@ -25,7 +28,9 @@
   
   # in your CGI:
   use Apache::SizeLimit;
  -Apache::SizeLimit::setmax(1);   # Max Process Size in KB
  +Apache::SizeLimit::setmax(1);   # Max size in KB
  +Apache::SizeLimit::setmin(1000);# Min share in KB
  +Apache::SizeLimit::setmax_unshared(12000); # Max unshared size in KB
   
   Since checking the process size can take a few system calls on some
   platforms (e.g. linux), you may want to only check the process size every
  @@ -66,10 +71,29 @@
   technique shown in this module and set my MaxRequestsPerChild value to
   6000.
   
  +=head1 SHARED MEMORY OPTIONS
  +
  +In addition to simply checking the total size of a process, this
  +module can factor in how much of the memory used by the process is
  +actually being shared by copy-on-write.  If you don't understand how
  +memory is shared in this way, take a look at the mod_perl Guide at
  +http://perl.apache.org/guide/.
  +
  +You can take advantage of the shared memory information by setting a
  +minimum shared size and/or a maximum unshared size.  Experience on one
  +heavily trafficked mod_perl site showed that setting maximum unshared
  +size and leaving the others unset is the most effective policy.  This
  +is because it only kills off processes that are truly using too much
  +physical RAM, allowing most processes to live longer and reducing the
  +process churn rate.
  +
   =head1 CAVEATS
   
   This module is platform dependent, since finding the size of a process
  -is pretty different from OS to OS, and some platforms may not be supported.
  +is pretty different from OS to OS, and some platforms may not be
  +supported.  In particular, the limits on minimum shared memory and
  +maximum shared memory are currently only supported on Linux and BSD.
  +If you can contribute support for another OS, please do.
   
   Currently supported OSes:
   
  @@ -87,6 +111,7 @@
   
   For solaris we simply retrieve the size of /proc/self/as, which
   contains the address-space image of the process, and convert to KB.
  +Shared memory calculations are not supported.
   
   NOTE: This is only known to work for solaris 2.6 and above. Evidently
   the /proc filesystem has changed between 2.5.1 and 2.6. Can anyone
  @@ -99,7 +124,8 @@
   
   =item AIX?
   
  -Uses BSD::Resource::getrusage() to determine process size.
  +Uses BSD::Resource::getrusage() to determine process size.  Not sure if the
  +shared memory calculations will work or not.  AIX users?
   
   =back
   
  @@ -121,12 +147,17 @@
   use Config;
   use strict;
   use vars qw($VERSION $HOW_BIG_IS_IT $MAX_PROCESS_SIZE
  - $REQUEST_COUNT $CHECK_EVERY_N_REQUESTS);
  + $REQUEST_COUNT $CHECK_EVERY_N_REQUESTS
  + $MIN_SHARE_SIZE $MAX_UNSHARED_SIZE $START_TIME);
   
   $VERSION = '0.03';