PDA

View Full Version : caching & SSI



boggly
08-19-2002, 01:08 PM
I'm thinking of making use of SSI for a site I'm working on to keep a consistent interface/layout. I was wondering if there was any way to get the client to cache the include(s), instead of having the server re-create the whole page every time? I also heard that XBitHack could be a solution to this problem, but there's are some potential security risks with it and was wondering if the risks are real.

-boggly

MCookie
08-20-2002, 03:36 AM
As far as I know XBitHack On is used together with mod_include on very busy servers to let the server parse only certain files or directories. You can't use it for caching.
Since your include files are a seamless part of your page when served to the browser you have to use JS files if you want parts of your pages cached. But that means that searchengine robots and users with JavaScript turned off can't follow your links.

boggly
08-20-2002, 05:15 AM
Oh, so you don't think SSI would be the way to go? I've also read something about mod_expires, could that be a viable option? Also, if I let the page be dynamically created every time, how heavy of a load on the server would that approximately be if assuming the includes would be around 15K or so? I know that I'm asking a lot of questions, but I really wanted to try to stay away from going the js route if at all possible.

Thanks though,
boggly

MCookie
08-20-2002, 03:43 PM
Well, yes, SSI is a smart way to go. And if you're not getting 20.000 hits an hour I wouldn't worry about stressing your server. I'm using 5 or 6 and an <!--#exec.cgi on every page myself and I've read about using up to 14-16 include files without noticing any delay in performance. Depending on the server's configuration, Apache on Unix can serve hundreds of browsers simultaneous. So why worry?
Anyways; you can't cache includes. As far as the browser concerns, SSI includes just don't exist. Browsers only see the complete page.

I don't know much of mod_expires, you can set and send expiration dates in your pages' HTTP headers to tell browsers (and proxy servers too, I think) whether or not to load the page from the cache or to fetch it from the server. From what I know, Apache 1.3 sends Pragma: no cache by default, but I've seen some proxy servers still serving pages from their cache. As long as you don't make changes to your pages, that's fine, but if you do, you won't like them being cached.

And by the way, I don't think it matters whether your includes are 3K or 15K. The server just sees a file that has to be included. In the end, it's the total size of the page plus images and JS files that matters.

boggly
08-20-2002, 06:17 PM
Okay, thanks for your insight!

-boggly