Hi

I got this working fine on my dev machine without too much trouble. But when I tried it on my production server things went astray.

On closer examination, it seems that in both cases the memory cache is not being shared between processes. The cahe is not that big though (a few hundred k perhaps) and it's probably worth the minor hit.

But on my home machine, the hash gets copied from the original version. On the production one, the object in other processes remains uninitialised.

I hadn't noticed before, but my home machine runs perl 5.8.7, the prod one 5.8.4. This shouldn't be, and I may well go for an upgrade later. I wonder if that is what causes the difference though? There is generally very little difference in apache config between the servers.

If anyone can point me to a clear explanation of how and when perl will share between processes, and how it might have changed between versions, I'd be grateful.

Thanks

D

On 2/7/06, Daniel McBrearty <[EMAIL PROTECTED]> wrote:
Thanks Jonathan

Just to be clear - the hash and the method to init it are declared and defined in MyModule like this:

{
 my $hash = 0;
sub init
{
  # fill in the hash completely
}

sub getValue
{
  # get stuff (die if $hash == 0, because not init'd)
}
}

in startup.pl is only

use MyModule ();
MyModule::init();

And this will make it shared ?

Thanks!

And BTW thanks for all the general good help on this list ... some of mod_perl looks a bit like the black arts at the start, but it's gettimg easier ... slowly ...

D


On 2/7/06, Jonathan Vanasco < [EMAIL PROTECTED]> wrote:

if it is in the hash at startup, all the children will access that
hash and share it.

if it written to after startup.pl, use memcached

On Feb 7, 2006, at 1:31 PM, Daniel McBrearty wrote:
> that any memory that gets written to will be seen as dirty, and
> therefore not shared. But if it is only written to at startup, will
> that still apply?



--
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131



--
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131

Reply via email to