Try Now
More in this section
Blogs RSS feed

Sitefinity performance boosters - keeping your pages warm

by Grigori Karanikolov

 A question I’ve received multiple times is “Why is it taking so long to load Sitefinity the first time after I recycle my application pool/restart my server/make change in my web.config file, etc"?

The answer is simple – it’s how .NET works!
Sitefinity is an ASP.NET web application. As such, the first time a user requests a resource from the website ASP.NET automatically compiles the application code and any dependent resources. Furthermore any application pool recycles, modifications in the source code or the top-level items of the application (such as the web.config, global.asax, etc) would cause ASP.NET to recompile the source files into assemblies. More info about ASP.NET’s application lifecycle can be found on MSDN.

So is there a way after a scheduled application pool recycle or change in the code for avoiding the first user to have to wait until the application recompiles? The answer is – yes, there is! It’s called application warm-up. It’s all about forcing the application to reinitialize after it has been restarted. It’s not something you do from within Sitefinity, just as recompilation doesn’t happen because of Sitefinity.

There are a couple of handy tools that work like a charm to achieve the required results:

1) Application Initialization for IIS 7.5 - IIS Application Initialization for IIS 7.5 enables website administrators to improve the responsiveness of their Web sites by loading the Web applications before the first request arrives.
Well, after giving it a try, it does do what it says on the tin! After installing it on your server, you can either configure forcing individual applications to reinitialize after an application pool recycle/server restart, or configure the applications to reinitialize after a soft reset (edits in web.config, etc).
In order to set up application warm-up after a recycle, you need to edit your %windir%\system32\inetsrv\config\applicationHost.config file and locate your <system.applicationHost> block. Edit the settings of the application you’d like to automatically initialize after a restart like this:

<add name="MyApplicationPoolName" autoStart="true" startMode="AlwaysRunning" managedRuntimeVersion="v4.0">

Next, under the <sites> block, configure the serverAutoStart property of your website like this:

<site name="MySiteName" id="#" serverAutoStart="true">
<application path="/" preloadEnabled="true" applicationPool=" MyApplicationPoolName ">

This way, even if you recycle your application pool on regular intervals or at a specific date/time, it will initialize automatically afterwards and initial load time will be normal for the first user that hits your website afterwards.

2) Keep Alive Service For IIS 6.0/7.5 – the keep alive service requires no configuration, i.e. you install and forget about it. It monitors your IIS metabase and keeps all websites warm and quick.

So far I’ve been experimenting with these two and they seem to work pretty well.
Feel free to add your own tips, tricks and suggestions to the list!


Leave a comment
  1. Steve Jul 09, 2012
    Good tip!  Wondered how to get this guy working...but the #2 link 404s here for me
  2. Grisha 'Greg' Karanikolov Jul 10, 2012
    Hi Steve,
    thanks for letting me know about the broken link, should work now!
    More on the configuration of the Application Initialization tool could be found here. This is what it says:

    The Application Initialization feature can be configured in two places: the machine-wide applicationHost.config file, and the application-level web.config file. Configuration in the applicationHost.config file contains "global" application initialization settings, while an application-level web.config file contains "local" application initialization settings.
  3. Mark McNeece Jul 18, 2012
    Hi Greg

    Thanks for this great tip.  Just to mention that startMode="alwaysRunning" should actually be startMode="AlwaysRunning" 

    The system complains if you don't use a capital letter.

  4. Grisha 'Greg' Karanikolov Jul 23, 2012
    Hi Mark!
    Thanks for the remark, I've corrected this in my post.
    And I've awarded you with some Telerik points for pointing this out to me.
  5. Austin Dimmer Nov 16, 2012

    Any tips as to how to achieve the same result if we are running in Azure?

    Appreciated if you do!
  6. Marcellino Bommezijn Feb 10, 2013

    If the default is already set you don't need to add individual in the system.applicationhost section.

    <applicationPoolDefaults managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" startMode="AlwaysRunning"> 

  7. Nafeez Aug 26, 2014
    any solution for page loading below the existing page
  8. Brian Mar 24, 2015
    Does this shrink the load time for every page on the site or just overall starting the site up on first visit? I am having a problem where every page takes forever the first time it loads but then speeds up afterwards. What can I do about that?
  9. Grisha 'Greg' Karanikolov Mar 25, 2015

    Hi Brian,

    I would recommend using the Sitefinity Primer for that - it's a tool that hits a chosen set of your pages and services and warms them up. This should speed up your page load time.

  10. Rahul Aug 28, 2015

    This is how .NET works??? Are you kidding me ... This is just a terribly designed CMS. There are dozens of other CMSes out there without this issue ... if we had known about this issue we would have never purchased this application but now we're half way through and no way to back out.

    For each page to take minutes (not seconds) to load just shows lack of development quality and understanding of real world web applications ... and the suggestion to pre-load pages as a workaround is laughable. Something I would expect a script-kiddie to suggest and not any serious engineer.

  11. Jacobsen K Aug 29, 2015

    We have also had poor performance experience with SFCMS with very long load times and responses. Pre-warming is ok for a short-term workaround but eventually you need to look at a more permanent solution. 

    Have you tried optimizing your TTLs as well as database? 

    In the beginning when lot of changes are happening you will find performance to be worse but this should get better over time also

  12. Vladi Sep 03, 2015

    Actually, Sitefinity is quite optimized when using its build-in components. However, its extensibility allows to plug in any custom code in many places and create custom widgets with poor performance. The performance of this custom code affect the overall performance of the application.

    The pages and templates compilation is also a kind performance improvement, which is related to the specific of the ASP.NET application. However, it appears as a bottleneck just after deploying the site on production, because the asp.net compiler cannot handle many precompilations at a time. Deploying the site means changing the bin folder. Application pool recycles does not cause precompilation. So, deployment is actually happens very rare in the real live scenario. Only in this cases you need to warm up the site.

    In order to optimize the deployment Sitefinity provides a precompiler tool (http://docs.sitefinity.com/for-developers-sitefinity-precompiler-tool), which allows to deploy a site with already compiled pages and in this way better handle the initial load just after deploying the site.

  13. Steve Nov 18, 2015

    My suggest is also remember to tweak your app config file.  Make sure to remove any unnecessary settings.  One of the biggest mistakes I see all the time is leaving the site in "debug" mode. 

    Make if you are using a custom web.config that setting is set to false on a production site.




    debug = "false"




    Hope this helps,

    Steve, MyriadMedia.com, DC area

    Leave a comment