Thursday, October 11, 2007

Move Images from MOSS to the File System

Background:

Images and Style Sheet files are all in the MOSS db when we deploy our feature. When the page loads, the images and style sheets are all retrieved from DB in real time. That means the page has to make a round trip to the DB each time in order to get those files. Thus, makes the page loading very slow.

Blobcache in the web.config can somehow solve this problem. But it's not stable. We experienced the slowness once in a while.

Solution:

Move the images and style sheets from the MOSS db to the file system. To do that, we will need to modify the solution package and redeploy it.

Comment out the file definitions in Feature.xml and Elements.xml.

Add the file definitions in Manifest.xml

Modify the master pages and style sheets to point the images to the file system.

1 comment:

Prashant said...

i think it is very useful tip. I was doing quite a lot of googling on how to use blobcache just to cache the images and CSS in Style Library folder instead of caching images for all the web application. (As i had some dynamic images as well, like profile pictures, which can be changed by user).

I am now going to use your tip to move the CSS and images for my custom master page to Layouts directory on file system and then use Content expiration in IIS 6.0 to allow max-age Caching on client side for better front end user experience.