Performance tweak: Optimizing StaticFileHandler in EPiServer CMS 5
The StaticFileHandler that serves files from a VPP is by default configured without a expiration date, or really a negative expiration time. That will cause the browser to, for every request, ask the server if there is a new version of the file, and most of the time EPiServer CMS will return a 304 Not Modified but it still have to look up the file to look at the changed date.
That is all good to make sure editors will always see the latest and greatest content, but it is probably overkill for your visitors. And because most editor are non-identified when they first visit the site we can't have different expiration times for different users because once they are identified we can't just call back the already cached file.
But, when you have a environment where you have separated vistors from editors using multiple sites (which is common in larger configurations) you should tweak this setting.
For example by changing the negative one day from:
<staticFile expirationTime="-1.0:0:0" />
to a couple of hours:
<staticFile expirationTime="4:0:0" />
The nice thing here is that you can have different settings for different directories. Adding a expiration time will get the most effect if you use on a directory that contains images that you often use on your site.
I am also (thanks to Svante) looking into kernel mode caching of the files to get the files delivered with blazing speed right from the kernel of IIS, but that will not be possible without some rewriting of the StaticFileHandler.
18 April 2008