On Jan 4, 2007, at 11:44 AM, Perrin Harkins wrote:

There's probably not much benefit from caching filehandles if you still have to read the files anyway. The best thing to do would be to port to a more mature templating system. Short of that, caching the templates in memory (just in a hash, not in a shared cache like the ones above) will give the biggest performance boost.

Agreed.

Using the filesystem handles as you described would actually be detrimental -- aside from the fact that you still have to read the files , you're looking at a lot of read/write on the memory related to the files -- on a per child basis. If you've got a single class handling it with a single variable, figure that you're going to consume memory representing the largest file you'll be reading -- per child. A lot of caching optimizers I've seen will store data in a string that is md5(file) -- which means you can have a var per file, per child -- which is a lot.

I'd strongly suggest to cache the files into memory at server start so that they're shared by all the children. If you need something quick, just create a class to manage 'reading' files that stores the data into a md5( /path/to/file ) variables on startup, and returns a ref to the string as needed. shouldn't take more than 30minutes to implement on the trickiest system.

// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


Reply via email to