Hi,
 
I'm using MP v2.000002, along with ActivePerl v5.8.8 and Apache v2.054, all that under Windows XP.
 
Under Win32, the Apache memory model is a threaded model, i.e. we have one master Apache process,and, then, one unique child process, containing several threads, that can, if needed, use Perl Interpreters taken from an interpreter pool.
This is what I have understood so far.
 
So, I'm trying to understand what's really shared when preloading modules from httpd.conf, and which benefits I could get from doing that.
 
The problem is that I can't really understand what's kept shared when new Perl interpreters are started.
 
From the MP docs, I have read that, among others:
Care is taken by Perl to copy only mutable data, which means that no runtime locking is required and read-only data such as the syntax tree is shared from the parent, which should reduce the overall mod_perl memory footprint.
 
I made tests to understand that. For example, a simple basic test has been to create a module with a simple basic sub:
 
########################
package Modules::MyPack;
sub test{
 1;
}
1;
########################
 
Then, I preloaded it in the parent process, including a "PerlRequire Modules/MyPack.pm" in httpd.conf.
 
At last, I wanted to make a test in a siple script, like that:
 
########################
my $sub = \&Modules::MyPack::test;
open FILE, ">>", "test.txt";
print FILE $sub, "\n";
close FILE;
########################
 
The purpose of this test is to see what is the actual memory address of &Modules::MyPack::test.
 
I ran this test with 3 concurrent Perl Intepreters and noticed that the returned address is different for each of them, which makes me think that there isn't any memory sharing, even for a simple preloaded subroutine. Indeed, I would have believed, if this very basic subroutine had been shared among intepreters, them to have the same actual memory address.
 
Am I getting wrong?
 
What's actually being shared among intepreters? How could I simply test the fact stuff is actually shared?
 
Thanks in advance,
 
Lionel.
 

Reply via email to