IIS 8.5 cold start

asp.net-mvciisiis-8.5net

I have a small ASP.NET MVC 5 web application hosted on VDS.
VDS has following config: 2.6 Gz CPU, 1 Gb RAM, 20 GB SSD, Windows Server 2012 R2, IIS 8.5.

There are maximum 5 concurrent users who can access this site. Everything is working fast, but cold startup can take much time. I know that there different options to decrease cold startup time:

  • I can make application's pool "always running" and set preloadEnabled to true.
  • Or I can use new "suspend" feature of IIS 8.5.

May be there are other possibilities I am not aware of. What is the best strategy to decrease cold startup time for my application?

Solution:

  • As suggested, I increased AppPool shutdown timeout. But rather then setting it to 12 hours, I set it to 0 (disabled it) and scheduled AppPool recycling to 04:00 AM.
  • I enabled Application Initialization and configured it to send request to a special page, that performs initialization. In my app it was initialization of DbContext.
  • Application Initialization module can only make http requests, but whole my app was protected by ASP.NET MVC RequreHttpsAttribute. So initially it failed to work. There is a workaround by disabling http to https redirection on local requests, as described here.

Best Answer

"Always running" is the best option from the sounds of it. Past that you'd need to provide more details.

Are you updating the application often during the day? If so, are you doing things at app startup? Pre-loading data into cache/etc?

Are the there monetary/resource concerns you have for not "always running it"? May be extend your AppPool shutdown timeout to 12 hours and write a scheduled task to hit your app at an earlier time before your users get there. This way it can be shutdown for the night.