You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Cristóvão Dalla Costa <cb...@bsi.com.br> on 2002/10/05 20:40:05 UTC

Apache::SharedMem

Does anyone have experience with Apache::SharedMem? I'd like to use it 
to store an in-perl cache of a few thousand database items, in order to 
decrease load, but I noticed that it's version 0.09 and not updated in a 
year, so I became a little suspicious. Any comments?

Thanks.


Re: Apache::SharedMem

Posted by Perrin Harkins <pe...@elem.com>.
siberian@siberian.org wrote:
> We are using IPC::MM and it works great.

IPC::MM is the fastest game in town.  It's only drawback is that the 
data is not persistent, so if you want your cache to persist across 
restarts it won't work for you.

Apache::SharedMem and all the other modules based IPC::ShareLite or 
IPC::Shareable are slow.  If IPC::MM won't work for you, I'd suggest 
MLDBM::Sync, Cache::FileCache, or Cache::Mmap.

- Perrin


Re: Apache::SharedMem

Posted by si...@siberian.org.
We are using IPC::MM and it works great. We use it to 
cache about 5000 strings for our internationlized systems 
( EFIGS-J right now, going to 15 languages soon ). Its 
pretty easy, in our startup handler we have :

my $MM_SIZE = 5000000;
my $MM_FILE = 'st_cache_mm_file';
my $st_cache_mm = IPC::MM::mm_create($MM_SIZE, $MM_FILE);
my $st_cache_btree = 
IPC::MM::mm_make_btree_table($st_cache_mm);
tie %CACHE::mmcache, 'IPC::MM::BTree', $st_cache_btree;

Then we access it via the $CACHE::mmcache variable by 
language ID/Message ID hashes.

The performance is pretty good, a huge huge improvement 
over direct to database calls. The way we have it 
configured is that each child calls a function per string. 
This function checkes the apache wide MM cache, if it 
doesn't find it then it grabs it from the DB and sticks it 
there for the next child to come along. We were using 'per 
child' caching but it was slow, expensive and gave page 
load speeds with a lot of variance ( .5-1.5 seconds for 
cache, 10 seconds for uncachced ). It was pretty nasty.

We are not really expiring our cache, we just HUP apache 
to re-initialize it since MM is local to the root apache 
process.

Your mileage may vary, ours is pretty good.

John

On Sat, 05 Oct 2002 15:40:05 -0300
  Cristóvão Dalla Costa <cb...@bsi.com.br> wrote:
>Does anyone have experience with Apache::SharedMem? I'd 
>like to use it to store an in-perl cache of a few 
>thousand database items, in order to decrease load, but I 
>noticed that it's version 0.09 and not updated in a year, 
>so I became a little suspicious. Any comments?
>
>Thanks.
>