perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Buchanan" <>
Subject [question] Help to cut down dirty memory
Date Wed, 15 Dec 2004 22:55:32 GMT
    I am designing a large system with the intent on everything running 
mod_perl with all the libraries pre-loaded into memory at system startup. 
At system startup the parent http-worker process is 28M RSS and the children 
are about 1.9 MB RSS.  After the first web request however, the child 
process goes to 15MB RSS and the parent drops to 20M RSS.  I realize that 
some memory will need to be localzed to the child processes for general 
variable setting-getting, but it seems extreme.  On successive hits, it 
climbs to 20MB for the child processes.

    I debugged memory usage as it climbed to see what calls were doing the 
dirtying.  Some examples, I fould were when Data::Dumper loaded it's XS 
module it gained about 600K, and on the first DBI connect (DBD::Pg) it 
gained 1500K.

    My general question is this: What more can I do to keep shared memory 
shared and not have each child so big?

    This is what I understand so far and am doing:

    1) Preload All libraries at server startup (don't use require to load 
them mid-request)

    My %INC after the first request is the same as it was at server startup.

    2) Stay away from package globals. Use objects as much as possible which 
keep instance vars in $self.

    95% of my libs are OO with no package globals.

    3) Avoid self-referencing structures like a hashref being referenced in 
a sub-sub-hashref (perl garbage collection does not catch them because a ref 
still exists)

    Should be none of these in the system.

    Any of these practices and others you may offer could help my libs, but 
my libraries only represent about half of the libs in %INC.  What can I do 
to fix problems like Data::Dumper's XSLoader problem?

    Any tips anyone can offer would be great.  This is my System setup:
Mac OS X 10.3 (tried on Redhat 9 as well)
Apache 2.0.50
Mod Perl 2 (1.99_16)
Perl 5.8.0
HTTP Conf Directives used:
PerlOptions +Parent
PerlSwitches              -w
PerlSwitches              -T
PerlModule Apache::Reload
PerlInitHandler Apache::Reload

    Dave Buchanan 

Report problems:
Mail list info:
List etiquette:

View raw message