When the website is accessed by the first few users the performance is very slow.
The Windows Azure setup is using IIS 7.0 so the warm up initialization module is not an option.
Is there a way to "warm up" the website so that this performance speed is not an issue?
I have looked at this: Controlling Application Pool Idle Timeouts in Windows Azure, but not sure if this will still cause an issue when Azure recycles the application pool every 29 hours approx.
UPDATE:
The deployment is 1 web role that contains multiple websites. Is it possible to do the pre-compilation for this? or use web roles as is suggested in one of the answers below?
EDIT:
As @Igorek has stated below regarding using Web Roles that auto-load themselves during Role's startup which is possible in the setup I have. Does anybody have an example of how to achieve this?
I have looked at this: Controlling Application Pool Idle Timeouts in Windows Azure, but not sure if this will still cause an issue when Azure recycles the application pool every 29 hours approx.
It won't cause an issue when Azure recycles the app pool, but you can also add to that startup task to prevent/increase the application pool recycling time.
Try this:
Define the task in your ServiceDefinition
:
<Startup>
<Task commandLine="startup\disableTimeout.cmd" executionContext="elevated" />
</Startup>
Then have your cmd
file with the following code (just put it into notepad, then save as a .cmd
file):
%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
Two things to make sure of:
1) Make sure you save the file with ANSI encoding.
2) When you've added that script into Visual Studio, make sure you select "Copy Always" as the "Copy to Output Directory" option in the properties.
Are you precompiling the application? By default, the application after being deployed still needs to be compiled for the first time. Depending on the size of the application, compile can take multiple seconds http://msdn.microsoft.com/en-us/library/399f057w(v=vs.85).aspx
When the first HTTP request arrives a lot of extra work is actually done - application pool is started, all needed assemblies are found, all assemblies shipped as MSIL are compiled into machine code, then the necessary ASP.NET views are precompiled (unless you deploy them precompiled, but it's quite hard with Azure tools so I guess you don't do that). This all takes some time and so the unlucky first users have to wait.
The workaround is to warm up the site from inside role entry point OnStart()
- make it precompile the site and then send an HTTP request to localhost.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With