# Using Application Initialization with Azure is still proving painfully slow

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))
{
}

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">
</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?

-

I take it that you have actually installed the Application Initialization module which is NOT included on a default IIS8 install?

Check out this great post for how to get it all up and running and hopefully that may sort out you problems.

-

While not directly answering your question, you may be able to make use of the new monitoring features in Azure to keep your site ticking over.

If you look in the management portal under the cloud service, there's a section labelled "web endpoint status". If you set that value then Azure will poll that page every couple of minutes or so.

-