RE: global variable

2010-02-04 Thread Morten Bjørnsvik
Hi

We have been using IPC::Cache for this for years, but it does not store 
typeglobs (filehandlers, sockets etc)
Forcing us to use local unix sockets to communicate with the backend daemon. 
This mean we always have to
have a daemon node on every web-server instead of just a single node. 

I do not see IPC::MMA store typeglobs either, is it faster?

We have our own workaround using IPC::SysV and IPC::Msg, they are extremely 
fast compared to IPC::Cache, but
has awkward hash key management I like to drop if we find something faster.


Thanks

--
Morten Bjoernsvik,  Experian Decision Analytics, Oslo, Norway.

-Original Message-
From: macke...@animalhead.com [mailto:macke...@animalhead.com] 
Sent: 3. februar 2010 18:18
To: m...@normalperson.e4ward.com
Cc: modperl@perl.apache.org
Subject: Re: global variable

I rewrote IPC::MMA from an earlier CPAN module so that I could
use shared memory among Apache children.  You can read about it at
http://search.cpan.org/~mackenna/IPC-MMA-0.6/MMA.pod

On Feb 2, 2010, at 9:45 PM, m...@normalperson.e4ward.com wrote:

 Hello,

 Is there a method to setup a global variable for all modperl child  
 processes?
 Also this variable will be updated sometime, when it get updated, all
 processes will know it.

 Thanks.



Re: global variable

2010-02-04 Thread craig

Hi,

IPC::MMA and its underlying MM library are written entirely in C.
I originally got into this business when I read some user reviews
that said that the predecessor module IPC::MM was the fastest
module of its kind that they could find.

IPC::MMA cleaned up several things in IPC::MM, including
generalized keys as in Perl hashes. (IPC::MM only allowed C
strings as keys.)  IPC:MMA is probably faster than IPC::MM.
But I've never done any benchmarks to back up this claim, nor
against other modules.

The direct-call interface is inevitably slightly faster than the
tied interface.

IPC::MMA only allows sharing among parent and child processes,
including between children.  The general idea is to create the
shared memory, and most or all of the data structures, in the
parent process before it forks (e.g., in an Apache PostConfigHandler).

If the relationship with the backend daemon isn't parent:child or
child:child, you can't use IPC::MMA to share data with the backend
daemon.

I have to plead ignorance of the fine points of typeglobs.  I've
used the * notation when an example told me to, without thinking
much about it.

Having read all the 'typeglob' references in Programming Perl and
those in the perl internal docs, they sound like data structures
containing addresses of things, i.e., references to things.
Except for addresses in shared segments, one process can only
access the content of its own memory via addresses, not the
memory of other processes.

In C, filehandles are just integers, which are eminently sharable.

Best Regards,
cmac


On Feb 4, 2010, at 12:33 AM, Morten Bjørnsvik wrote:


Hi

We have been using IPC::Cache for this for years, but it does not  
store typeglobs (filehandlers, sockets etc)
Forcing us to use local unix sockets to communicate with the  
backend daemon. This mean we always have to

have a daemon node on every web-server instead of just a single node.

I do not see IPC::MMA store typeglobs either, is it faster?

We have our own workaround using IPC::SysV and IPC::Msg, they are  
extremely fast compared to IPC::Cache, but
has awkward hash key management I like to drop if we find something  
faster.



Thanks

--
Morten Bjoernsvik,  Experian Decision Analytics, Oslo, Norway.

-Original Message-
From: macke...@animalhead.com [mailto:macke...@animalhead.com]
Sent: 3. februar 2010 18:18
To: m...@normalperson.e4ward.com
Cc: modperl@perl.apache.org
Subject: Re: global variable

I rewrote IPC::MMA from an earlier CPAN module so that I could
use shared memory among Apache children.  You can read about it at
http://search.cpan.org/~mackenna/IPC-MMA-0.6/MMA.pod

On Feb 2, 2010, at 9:45 PM, m...@normalperson.e4ward.com wrote:


Hello,

Is there a method to setup a global variable for all modperl child
processes?
Also this variable will be updated sometime, when it get updated, all
processes will know it.

Thanks.