I'm one of those guys who clicks on 'remind me in 3hrs' and then clicks the 'download' now Windows Update feature, so I found myself with some spare time to fiddle around with one of my pet things... getting Sitefinity v4 to run as smooth as possible.


Over time I've tweaked and updated configuration settings. Done all the minification/combining and cache/compress settings that can be done on the Sitefinity end. And it's fast, I love it.


Comparing to an old v4.0 community edition I still got installed it's amazing what an optimization the Sitefinity team achieved in just a few months. But, like many developers, it's not the runtime speed when in production is the most agrivating, but the runtime speed during development.

You tweak a CSS rule, change some codelines in a widget... and those 4-10-20 seconds you have to wait for just that one typo is nerve wrecking...


The setup

When I'm developing, I'm usually developing on a local machine. The database may sometimes be external, but preferrably I like to develop offline so to speak. Early on developing with Cassini (Visualstudio's integrated IIS server) or Sitefinity's Project Manager webserver proved to be very slow. IIS, which is built into Windows 7, proved to be the most stable and fast at running Sitefinity so normally when working on a project, I create two named instances in IIS pointing to a local directory to which VisualStudio publishes.


In the morning I open up my working copy in VisualStudio, hit publish and it builds and publishes to the wwwroot\projectname\www_d folder. I fire up my browser go to http://projectname.d.tld and I'm up and running.


Now over the past time I've tried to tweak SQL Server and IIS settings aswell. But still I felt there was more to gain.... reading up on an article about SSD harddrives and how they use memory as a diskcache I thought I found a way to speed things up with an old fashion ramdisk.


Naturally this won't solve everyone's problems/nerves while developing with Sitefinity or some other project, but if you're doing 'local' development and constantly finding yourself refreshing and clearing cache, this is definately a life saver.


What's the gain...

I haven't done proper lab testing but with two (almost comparable) local machines, running same project I'm seeing an tenfold decrease in page loading time both on backend and front end pages. Particularly the ever so slow backend pages like page-overview and page-edit.


For instance a page-edit, with cold cache, loads in under 2sec. with in total 90 requests and 1.66mb download.


The turbo switch

The secret lies in IIS compiled caching. Normally, when freshly deployed or after an application pool reset, things take forever to come up. On the backend, IIS is compiling/prefetching and caching the app and finally serves it. By moving this 'cache' from harddisk to a ramdisk, we get a tremendous performance boost. And all this can be achieved, with a minor adjustment to your web.config.
Just find the <compilation> tag and add the tempDirectory="driveletter:\foldername\" to it until it looks similar to this
<compilation debug="true/false/depending on build type ofcourse" targetFramework="4.0" tempDirectory="G:\cache\">
where the G: drive is ofcourse your ramdisk.


I've tried it with several Sitefinity projects and with an average projectsize between 75-100Mb you need about 50-60Mb of ramdisk space. To me, a tenfold and even a fivefold decrease in loading time is worth giving up 60Mb of my 4Gb of RAM on my laptop and not gonna even be casual about disk space with my regular dev workstation.


Where to get it...

I'm running Windows7 32/64 bit and I went for the RamDisk utility by DataRam. It's a free utility, if you keep it below 4Gb. The installation takes no more than 5 minutes. Once running, you can define the size, what filesystem (FAT16 or FAT32) and voila, you have an extra drive in your Windows environment.


Restart IIS, rebuild and republish your project and then fire up your browser!