in reply to Ways of caching

Some issues to reflect on:

  1. How do you determine when you can serve from cache and when you need to 'refresh'. For example say we were talking this node and you cached the node and all responses at time X. If there is a new reply how do you recognise that the cache entry is now invalid?
  2. How do you plan to expire from cache? If you don't clean out old stuff you will quickly build up lots of files.
  3. Related to the above. If you cache a lot of info you will find some ugliness with the filesystem. As you move towards 10,000 files per dir things start to grind to a halt (except maybe with Reiser FS, certainly with ext2/3). As a result you often need a heirarchy ie A/B/ABlog.dat

You may find that squid fills the ticket very nicely. Look for http accelerator mode in the FAQ. In essence you set up squid on port 80 and your httpd on say port 81. The incoming requests all hit squid (which is the defacto standard caching server). If squid reckons it is cachable it serves it from its cache, otherwise it gets it from your web server. The beauty is that all the details are taken care of. As always YMMV and dynamic content is more suited to a customised approach.

cheers

tachyon

Replies are listed 'Best First'.
Re^2: Ways of caching
by kiat (Vicar) on Jul 05, 2004 at 14:53 UTC
    Thanks, tachyon!

    I'm on a shared server so I guess I can't tweak the server to produce the desired result but I'll read the articles you suggested.

    I'm a little lost with Point #1. I'm writing only to one file. So when a post or reply is made, the information on the last 15 topics that's processed from the database is written to that file. When someone clicks on the the discussion board, that file is served via an INCLUDE_TMPL directive.