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?
- 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.