My assumption was that if I turned on IIS8 Application Warmup in Azure, that all of my sites would be fairly instant on load, this is not the case.
So, basically, I've turned on preloadEnabled
and set the startMode
to AlwaysRunning
, using:
public class WebRole : RoleEntryPoint
{
public override void Run()
{
using (var serverManager = new ServerManager())
{
foreach (var application in serverManager.Sites.SelectMany(c => c.Applications))
{
application["preloadEnabled"] = true;
}
foreach (var appPool in serverManager.ApplicationPools)
{
appPool["startMode"] = "AlwaysRunning";
}
serverManager.CommitChanges();
}
}
}
I've also disabled the recycling of the IIS app pools and the periodic IIS restart, using the following start up task:
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.recycling.periodicRestart.time:00:00:00
In each of my sites, I've put the following in my web.config:
<system.webServer>
<applicationInitialization skipManagedModules="true">
<add initializationPage="/" />
</applicationInitialization>
</system.webServer>
But still, all of my sites still take 30 seconds on first hit. If I remote into the machine before hitting any of the sites, I can see all of the settings are applied in IIS. I can also see that the sites are idling around 60-80MB of memory (insinuating that they've been preloaded).
My question is, is this as good as preloading gets? Surely it's meant to be faster? I was expecting the delay to be minimal, maybe 2 or 3 seconds on first load?