perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: MP1 -> MP2 migration Problems.
Date Mon, 18 Feb 2008 09:40:55 GMT

Perrin Harkins wrote:
> On Thu, Feb 14, 2008 at 9:13 AM, Rafael Caceres <> wrote:
>>  This is the first time that NOT using "use" because it was preloaded is
>>  mentioned. In fact, how would the modules compile (while testing for
>>  example)?
> Modules loaded into the perl interpreter at startup are still there
> when the process forks, so technically you don't have to ask for them
> again.  I still recommend that you use() them in every module that
> needs them, for testing and for documentation.
>>  > (At the cost of having them (insibly) duplicated in all the children
>>  > processes).
>>  Again, this is the first time this is mentioned. It would mean that, say
>>  10 or 20 scripts under mod_perl using DBI,DBD::Oracle,CGI and Template
>>  would have the effect of using up to 20 times the memory footprint?
>>  Wasn't preloading suposed to do the exact opposite?
> I think that was just a wording mistake.  When the process forks, the
> loaded modules are shared by the operating system's copy-on-write
> feature.  I believe that's what he was trying to say.
> - Perrin
Well, it was not exactly what I was trying to say, but undoubtedly this 
reflects my incomplete personal understanding of the process anyway, and 
I stand ready to be educated.

What I have until now believed is that perl "code" is in fact "data" for 
the perl interpreter, and that as such it cannot really be "shared".
What I mean is that, as soon as some bit is changed in a "page" of any 
perl module, that "page" is dirty and must be copied and made private to 
the one child process. And since there is (in my understanding) not such 
a clear separation as to which parts in "perl code" are data and which 
are code, after a while one ends up with a full duplicate in each child 
anyway.  Probably badly explained, but not so in the general sense ?

- André

P.S. What I really meant originally, is that if the speed to make it 
work was of the essence, it might be easier to (find/grep) and remove 
the various use Apache-x() from the multiple modules or cgi scripts, and 
put them all in the startup script.  Then later one could go back and 
refine things, if it makes a difference.

View raw message