ModPerl

WebHome | UnixGeekTools | Geekfarm | About This Site

Pointers

my notes from ApacheCon 2005

Requirements

CGI

mod_perl

mod_cgi setup

    LoadModule cgi_modudule libexec/mod_cgi.so
    ScriptAlias /cgi-bin /var/www/cgi-bin

benchmarking

     ab -c1 -n50 http://.../x.pl

mod_perl setup

    LoadModule perl_module modules/mod_perl.so
    Alias /perlrun /var/www/cgi-bin

    <Location /perlrun>
      SetHandler perl-script
      Option +ExecCGI
      PerlHandler ModPerl::PerlRun
    </Location>

ModPerl::PerlRun

ModPerl::Registry

ModPerl

CGI emulation

my notes from ApacheCon2005

intelligently compare speeds

mod_status

    LoadModule status_module modules/mod_status.so
    ExtendedStatus On

    <Location /server-status>
      SetHandler server-status
    </Location>

Apache2::Status

    <Location /perl-status>
      SetHandler perl-script
      PerlHandler Apache2::Status
      PerlSet Var StatusOptionsAll On
    </Location>

memory usage

shared memory

module preloading

Registry Preloading

    #startup.pl
    use ModPerl::RegistryLoader ();
    my $rl = ModPerl::RegistryLoader->new(
        package => ¡ÆModPerl::Registry¡Ç,
        debug   => 1,
    );
    $rl->handler($url, $filename);

use Foo vs. use Foo ()

    # saves 400K
    use POSIX ();

Apache2::Const

    use Apache2::Const qw(OK DECLINDED);
    use Apache2::Const -compile => qw(OK DECLINED);

    # now use something like this?
    return $Apache2::Const::OK

Other differences

PerlOptions - might want to turn off

KeepAlive

memory leaks

Apache2::SizeLimit

    #startup.pl
    use Apache2::SizeLimit;
    $Apache2::SizeLimit::MAX_PROCESS_SIZE   = 12000;
    $Apache2::SizeLimit::MIN_SHARE_SIZE     =  6000;
    $Apache2::SizeLimit::MAX_UNSHARED_SIZE  =  5000;
    $Apache2::SizeLimit::CHECK_EVERY_N_REQUESTS = 4;

    #httpd.conf
    PerlCleanupHandler Apache2::SizeLimit

profiling

Apache::DProf

- PerlModule Apache::DProf

Devel::Profiler::Apache

Odd Speedups

Apache::DBI

    PerlModule Apache::DBI
    PerlModule DBI

stat

AllowOverride

PerlTransHandler

*** $r->finfo - when httpd is serving a file, it had to stat() it - it's cached and can be used - use APR::Finfo (); my $finfo $r->finfo

print()

$|




Updated Sun Jul 23, 2006 12:12 PM