Hi Craig Thanks for the info. You should add this to the perldoc, as selling points making it more attractive in the IPC::* modules jungle.
IPC::Cache is limited by Storable. It is Storable that do not allow typeglobs. There is no problem storing whatever data as long as it resides in shmem and you only issue references to it. We do it manually, but I've not found any cpan modules that do this. Or maybe many may work, but they do not have it documented in the perldoc. We will try your module and play around with it, Thanks again -- MortenB -----Original Message----- From: cr...@animalhead.com [mailto:cr...@animalhead.com] Sent: 4. februar 2010 19:06 To: Morten Bjørnsvik Cc: modperl@perl.apache.org list Subject: Re: global variable 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. >