You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Bill Moseley <mo...@hank.org> on 2000/09/28 20:46:09 UTC
Loading modules in Parent??
Hi,
I'm seeing the opposite results from pre-loading modules in the parent
process than I would expect. It looks like pre-loading modules ends up
using more non-shared ("private") memory.
This is on SunOS (SunOS Release 5.6 Version Generic_105181-17 [UNIX(R)
System V Release 4.0]), and I know very little about memory usage on that
machine other than some white paper I read a year ago that discussed the
pmap program. I'm using /usr/proc/bin/pmap to look at the memory of the
process.
/perl-status?inc is confirming the pre-loaded and non pre-loaded
configurations.
This is what pmap -x is showing:
Address Kbytes Resident Shared Private Permissions Mapped File
-------- ------ ------ ------ ------
total Kb 19968 18528 2816 15712 <<-- preloaded modules
total Kb 11528 10152 2656 7496 <<-- not preloaded
I'm curious why the "private" memory usage is so much more when pre-loading
the modules. It looks like, for memory concerns, I should not pre-load
modules.
Here's ps output from the pre-loaded test
S USER PID PPID %CPU %MEM VSZ RSS STIME TIME COMMAND
S lii 14096 1 0.0 0.3 7568 4688 10:25:50 0:00 httpd-t
S lii 14097 14096 0.0 0.9 19968 17136 10:25:50 0:05 httpd-t
I'm running an Apache 1.3.12/mod_perl 1.24 server with it only forking off
one child server (all request are handled by a single child process). I'm
making the same requests of the server each test, and I get the same
numbers if I repeat the test.
Here's the pre-loaded module list. When running as non-pre-loaded I'm
commenting out Search, SWISH::Fork, and CGI->compile lines below. That's
the only difference.
In the main httpd.conf server config.
<perl>
use lib qw (
/data/_g/lii/testLII/cgi-bin
/data/_g/lii/perl_lib/lib/5.00503
/data/_g/lii/perl_lib/lib/site_perl/5.005
/data/_g/lii/perl_lib/lib/site_perl/5.005/sun4-solaris
);
use Search ();
#use CGI ();
#use LII ();
# use Date::Format ();
# use Time::Local ();
# use Time::Zone ();
# use HTML::TokeParser ();
# use HTML ::Parser ();
# use HTML:: Entities ();
# use HTTP::Date ();
# use SWISH ();
# use SWISH::Stemmer ();
# use UserDB ();
# use DB_File ();
# use Fcntl ();
# use Tie::Hash ();
use SWISH::Fork ();
# use base ();
# use Symbol ();
# use Sys::Signal ();
# use IO::Handle ();
# use IO ();
# use SelectSaver ();
CGI->compile(':all');
</perl>
Bill Moseley
mailto:moseley@hank.org
Re: Loading modules in Parent??
Posted by Bill Moseley <mo...@hank.org>.
At 12:04 AM 10/02/00 -0600, Scott Wilson wrote:
>I've seen a similar result on an IRIX installation I'm working on.
>Anyone have any ideas?
So did you decide NOT to pre-load modules?
>
> Scott
>
>Bill Moseley wrote:
>>
>> Won't someone comment on this post? That's a chunk of memory!
>>
>> At 11:46 AM 09/28/00 -0700, Bill Moseley wrote:
>> <snip>
>> >This is what pmap -x is showing:
>> >
>> >Address Kbytes Resident Shared Private Permissions Mapped File
>> >-------- ------ ------ ------ ------
>> >total Kb 19968 18528 2816 15712 <<-- preloaded modules
>> >total Kb 11528 10152 2656 7496 <<-- not preloaded
>>
>> It's almost all heap:
>> 00164000 16376 15256 312 14944 read/write/exec [ heap ]
>> 00164000 7592 6608 104 6504 read/write/exec [ heap ]
>>
>> Is this an issue just with Solaris or is this expected (and seen) on other
>> platforms?
>>
>> Bill Moseley
>> mailto:moseley@hank.org
>
>
Bill Moseley
mailto:moseley@hank.org
Re: Loading modules in Parent??
Posted by Bill Moseley <mo...@hank.org>.
Won't someone comment on this post? That's a chunk of memory!
At 11:46 AM 09/28/00 -0700, Bill Moseley wrote:
<snip>
>This is what pmap -x is showing:
>
>Address Kbytes Resident Shared Private Permissions Mapped File
>-------- ------ ------ ------ ------
>total Kb 19968 18528 2816 15712 <<-- preloaded modules
>total Kb 11528 10152 2656 7496 <<-- not preloaded
It's almost all heap:
00164000 16376 15256 312 14944 read/write/exec [ heap ]
00164000 7592 6608 104 6504 read/write/exec [ heap ]
Is this an issue just with Solaris or is this expected (and seen) on other
platforms?
Bill Moseley
mailto:moseley@hank.org
Re: Loading modules in Parent??
Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 28 Sep 2000, Bill Moseley wrote:
> Hi,
>
> I'm seeing the opposite results from pre-loading modules in the parent
> process than I would expect. It looks like pre-loading modules ends up
> using more non-shared ("private") memory.
...
> Here's the pre-loaded module list. When running as non-pre-loaded I'm
> commenting out Search, SWISH::Fork, and CGI->compile lines below. That's
> the only difference.
that's a BIG difference.
% perlbloat 'require CGI'
require CGI added 784k
% perlbloat 'require CGI; CGI->compile(":all")'
require CGI; CGI->compile(":all") added 2.0M
try without preloading CGI.pm/CGI->compile in either.
p.s. this is the perlbloat script:
use GTop ();
my $gtop = GTop->new;
my $before = $gtop->proc_mem($$)->size;
for (@ARGV) {
if (eval "require $_") {
eval {
$_->import;
};
}
else {
eval $_;
die $@ if $@;
}
}
my $after = $gtop->proc_mem($$)->size;
printf "@ARGV added %s\n", GTop::size_string($after - $before);