There should be a simple answer to this, but I wanted to provide context behind it before asking. I suppose this is both a question and a cautionary tale.
What I'd LOVE to be able to do is share a large data structure (a hash of hashes, arrays, and scalars) reliably in a mod_perl environment without incurring the penalty of serializing the data, as is done with IPC::Shareable or IPC::ShareLite via Storable. This doesn't appear to be possible.
The reason I'd love to do this is because serializing with Storable is more expensive than I thought, and is the major performance bottleneck in my application. Luckily, I'm at a point where I can do a redesign without too much pain.
One way I approached it, originally, was to create a global hash %data with use vars qw/%data/;. I have my data structure stored on disk with Storable- what I'd do is compare the modification time of the file on disk with a modification time in the global %data, and if they differed I'd reload the data structure from disk. This didn't work, my guess is because, given that I'm storing the whole data structure as references, and that you can't really depend on globals in a mod_perl environment, that basically NOTHING was as it seems, including the time stamps I was attempting to use for a "staleness" check.
So- stated again- is there any way to RELIABLY share data between mod_perl httpd children without serializing it? My mind says no, but my heart say "god, I hope so.". Perhaps this is a lesson learned- serializing is great, but not for large data structures when performance is concerned.
-Any sufficiently advanced technology is
indistinguishable from doubletalk.
In reply to Sharing data structures in mod_perl by Hero Zzyzzx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |