=======================================================================

Apache::LoadAvgLimit

What this?
    * Apache::LoadAvgLimit returns HTTP status 503 if the system
      load-averages is over the limited value. It's useful to
      prevent your machine from freezing by high CPU load.

Requirements
    * Apache web server + mod_perl environment
    * getloadavg() system call (or try GetAvg.pm.uptime instead)

Note
    * I guess A::L::GetAvg.pm might be replaced to Sys::Load module.
        (but Sys::Load requires Perl 5.6.0 or above to install...)

=======================================================================

NAME
    Apache::LoadAvgLimit - limiting client request by system CPU
    load-averages

SYNOPSIS
      in httpd.conf, simply

      <Location /perl>
        PerlInitHandler Apache::LoadAvgLimit
        PerlSetVar LoadAvgLimit 2.5
      </Location>

      or fully

      <Location /perl>
        PerlInitHandler Apache::LoadAvgLimit
        PerlSetVar LoadAvgLimit_1 3.00
        PerlSetVar LoadAvgLimit_5 2.00
        PerlSetVar LoadAvgLimit_15 1.50
        PerlSetVar LoadAvgRetryAfter 120
      </Location>

DESCRIPTION
    If system load-average is over the value of LoadAvgLimit*,
    Apache::LoadAvgLimit will try to reduce the machine load by returning
    HTTP status 503 (Service Temporarily Unavailable) to client browser.

    Especially, it may be useful in <Location> directory that has heavy CGI,
    Apache::Registry script or contents-handler program.

PARAMETERS
    LoadAvgLimit

    When at least one of three load-averages (1, 5, 15 min) is over this
    value, returning status code 503.

    LoadAvgLimit_1, LoadAvgLimit_5, LoadAvgLimit_15

    When Each minute's load-averages(1, 5, 15 min) is over this value,
    returning status code 503.

    LoadAvgRetryAfter

    The second(s) that indicates how long the service is expected to be
    unavailable to browser. When this value exists, Retry-After field is
    automatically set.

AUTHOR
    Okamoto RYO <ryo@aquahill.net>

SEE ALSO
    mod_perl(3), Apache(3), getloadavg(3), uptime(1), RFC1945, RFC2616

