domingo, 20 de octubre de 2013

This week has been an awesome one for those using Windows Azure to deploy their services. As soon as Microsoft announcing the general availability of Windows Server 2012 R2, the image was available on all Azure Datacenters worldwide to start creating new devices with the latest OS, not only for the Virtual Machines flavor (IaaS), also for Cloud Services (PaaS). This converts Microsoft’s Cloud in the first one allowing to deploy VMs with it.

The new features included in this OS version are really awesome, and if you are publishing a website on Azure via VMs or Cloud Services you will be really-really happy, because two new enhancements included: IIS 8.5 and .NET Framework 4.5.1.

And that isn’t all, seems that Windows Server 2012 deploys a 30% faster than other previous Windows Server OS images on Azure, so deployment operations like redeploying a hosted service, creating staging environments, etc. will be done faster!! Did I mention new price cuts for memory intensive instances?

Application performance

On this framework release, some “most requested features” have been included, like the x64 edit and continue feature, the ADO.NET connection resiliency (I will write a separate blog post only for this one), etc. You can find an overview of this improvements on this MSDN blog post, but I would like to highlight two features because directly affects the performance of DNN running on Windows Azure, a subject that as you may know, I have been working on for the past years. Microsoft has delighted us by running and documenting the performance improvements using DNN Platform, so let’s summarize the results.

ASP.NET App Suspend

Until now, when an application hosted on IIS was idle for some time (20mins by default), the site was terminated in order to preserve server resources. The problem was that with applications like DNN that takes some seconds to warm-up to serve the first web request (let’s call this “cold startup”), a site with low traffic would appear really slow because would spend more time warming the application pool than serving the contents. The workarounds were to increase the Idle Time-out property of the pool, or when not having access to the IIS configuration, to use external periodic webrequests to avoid the application being shutting down. But this techniques were in detriment of server’s resources and many hosters were banning this type of webrequests to not end up with the server shared resources.

This new feature allows applications hosted on IIS 8.5 to be suspended instead of being terminated, so when the site is shutdown because of the idle timeout, instead of completely killing the worker process, all the state is saved into disk. A new webrequest to the application pool causes to bring the worker process again back into memory, and for the case of DNN, this means around a 90% of improvement. This really rocks!!

Check this video to see the experiment done by Microsoft guys that led to the numbers above.

The second great improvement in application performance with the .NET Framework 4.5.1 release is the Multi-core JIT support for applications using Assembly.LoadFrom and Appdomain.AssemblyResolve like DNN Platform, so if your are using a Medium sized or greater VM on Azure (VMs with more than one core), you will notice a good improvement on cold startups.

Enabling the awesome features

The Multi-core JIT feature is enabled by default if you use Windows Server 2012 R2 or just upgrade to .NET Framework 4.5.1, so you don’t need to do anything to turn it on. The ASP.net App Suspend feature can be enabled on IIS 8.5 in the application pool advanced settings:

New service package for cloud services

While using Virtual Machines (IaaS), this can be easily achieved by deploying the new Windows Server 2012 R2 server image. But to get these benefits on a Cloud Service (PaaS) when using the DNN Azure Accelerator you will need to use the latest accelerator’s service package because as fix was needed.

What fix? I tested today that while changing the OS to Windows Server 2012 R2 instance, the service was cycling on the startup tasks. The cause of this was that the ocsetup.exe used to install the remote management service -that is needed to setup WebDeploy- is no longer included on the system32 folder on WinSrv2012 R2.

The new way of enabling features is by using “dism”, so after doing the following changes on the startup task (check http://forums.iis.net/t/1171432.aspx for more info), all worked fine:

The new packages are available as an addon to the current DNN Azure Accelerator that you can download from CodePlex, called “DNN Azure Accelerator OS Family 4 packages”. Just download the .zip file and unzip it into the “/packages” folder in the accelerator. You will see those packages in the package selection step in the wizard.

After deploying an instance with one of this new packages, you will notice that the DNN site is running on top of IIS 8.5.

Hope this helps. If you have any question, just drop a comment on the post.

Thanks.

P.S. Have you seen the IIS 8.5 default page? Not yet? Here a screenshot