kosun has asked for the wisdom of the Perl Monks concerning the following question:

Greetings

I need a module to cache a small out of data, normally obtained from database, for cgis.

This will be on linux machines and there will be lots of requests.

I"ve been playing with a lot of the modules...

This seems to be one of the best

Cache::FastMmap

But i'm a bit afraid to use that on a high load server with many hits on the cgis, shared memory and all. Seems like a good way to get into trouble.

I'm reading what seems like the next best alternative is slow however...

Cache::FileCache

All i really want is something that autoexpires the data, is fast and stable for large scale usage.

Any suggestions or comments on this? I was surprised this wasn't in the FAQ actually.

thank you
KS

Replies are listed 'Best First'.
Re: Caching module for CGI
by dragonchild (Archbishop) on May 02, 2005 at 17:57 UTC
    Cache it in your startup.pl. Alternatively, DBM::Deep may not be a bad solution.

    The Perfect is the Enemy of the Good.

Re: Caching module for CGI
by TedPride (Priest) on May 02, 2005 at 17:58 UTC
    How big is the "small out of data"? How many sets of data will be in use at any given time? Do you have to worry about different instances of the script overwriting each other's cache or not? You can undoubtedly write yourself a custom cache routine that will be more efficient than Cache::FastMmap or Cache::FileCache, but methodology is hard to suggest without knowing more specifics.
Re: Caching module for CGI
by eXile (Priest) on May 03, 2005 at 04:57 UTC
    I've had pretty good experiences with Cache::FileCache. I think it's important to point out that the 'caching-experience' is related to your server setup. Cache::FastMmap is a bad idea if your server is low on RAM, and Cache::FileCache might not that slow if you have a superfast disk-setup (RAID0 with superfast disks for example).

    The only way you'll know for sure what will work in your situation is to do some kind of performance analysis of a couple of solutions.