Perrin Harkins wrote:
> Buddy Lee Haystack wrote:
> >
> > How much of a performance penalty does using Apache::SizeLimit have?
>
> Not enough that you'll notice it.
>
It really depends on 2 things:
 - What OS you're on
 - How complex your scripts are.

Here's the code that does the size check, which varies depending on your OS:
----
# return process size (in KB)
sub linux_size_check {
    my $size = 0;
    local(*FH);
    if (open(FH, "</proc/self/status")) {
  while (<FH>) { last if (($size) = (/^VmRSS:\s+(\d+)/)) }
  close(FH);
    } else {
  &error_log("Fatal Error: couldn't access /proc/self/status");
    }
    return($size);
}

sub solaris_2_6_size_check {
    my $size = -s "/proc/self/as" or
  &error_log("Fatal Error: /proc/self/as doesn't exist or is empty");
    $size = int($size/1024); # to get it into kb
    return($size);
}

sub bsd_size_check {
    return( (&BSD::Resource::getrusage())[2] );
}
----

As you can see, your mod_perl handler would have to be _extremely_ simple
for this code to take a non-trivial proportion of its run-time.


Reply via email to