in reply to Sharing data structures in mod_perl
What makes you so sure that serialization is the problem? Storable is very fast. It sounds to me like the problem is that you are serializing the entire data structure every time, instead of just the one tiny chunk of it that you need to look at.
Your problems with the staleness check sounds like some kind of bug in your code. There is no problem with globals in mod_perl, or references, or file mod times. I couldn't say more without seeing the code. Anyway, as I said, storing and loading the entire hash is not an efficient way to do this.
I'm presenting a paper on the most efficient data sharing modules at the Perl Conference this year, but I'm not done with my benchmarking yet so I can't tell you the winner. I do recommend that you try MLDBM::Sync or Cache::Cache. Both of them give you a hash-like interface (MLDBM::Sync is a tied hash module, while Cache::Cache provides get/set methods for key/value pairs), and each element of the hash can contain arbitrary data structures. Don't stuff all your data into one element of the hash, or you'll defeat the purpose. The idea is to only de-serialize the small piece of data your program needs at any given moment.
Hope that helps. When I have more information about which data sharing modules are fastest, I'll post some data about it on perlmonks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Sharing data structures in mod_perl
by Hero Zzyzzx (Curate) on Mar 28, 2002 at 17:14 UTC | |
by perrin (Chancellor) on Mar 28, 2002 at 17:20 UTC | |
by mla (Beadle) on Mar 30, 2002 at 05:43 UTC |