How to Speed up Windows Azure Deployments

The most common question I get asked about Windows Azure [aside from cost] is “How do I speed up my Deployment”. In this post I’d like to address this question and hit on a few things that most people don’t really think about in terms of what it means to deploy to Windows Azure.

Upgrade Hosted Service instead of New Deployment

Many people aren’t aware of this functionality and it can save you some serious time. Upgrading your service doesn’t shut off the Guest VM thus being able to deploy new bits to an existing hosted service is quicker. Perform an In-Place Upgrade.

Gotchas

Cannot:

  • Change the Type of Role that is Deployed: Web, Worker or VM Role
  • Increase the Size or Number of Instances of your Service
  • Change Configuration Settings or Values
  • Add/Change the number of Input or Internal Endpoints or their Values
  • Add/Change Certificates deployed to your instance
  • Add/Change Local Resources for your instance

Windows Azure - In-Place Upgrade

Limit Your Startup Tasks or Move to a VM Role

Startup tasks are one of my favorite additions to the Windows Azure Deployment Model. They introduced the ability to add required functionality to the Guest OS which would have been rather tedious or almost impossible to set up using C# during the Role Startup [Read more about the Windows Azure Role Startup Life Cycle].

Even though I love startup tasks so much you need to learn when enough is enough. Even though there is a timeout for startup tasks, any lengthy execution of a startup task does effect the startup time of your role.

Introducing the VM Role

With the Role Startup Cycle being a continuous process [occurs every time the role is recycled or scaled out]. The VM Role takes the repetition out of the process as additional functionality or components can be pre-loaded/configured then the entire VM can be uploaded in order to replace the typical Windows Azure Guest OS.

Learn how to Create a VM Role and get rid of all of the overhead of countless installations of the same software in your critical business application.

Windows Server 2008 R2 with Hyper-V

VIP Swap to Avoid Downtime or Update Deployment

The benefit of the VIP [Virtual IP] SWAP is it allows a brand new service to be deployed [in the staging slot of your Windows Azure Environment] then Upgraded to the Production Slot to be accessed by the World. This provides the benefit of minimal downtime as the VIP Swap operation does an internal DNS Change within the Windows Azure Platform. If the deployment requires a to change the physical deployment of your application [which cannot be performed during an in-place upgrade] the VIP swap is a perfect scenario to deploy an enhancement to your application.

To do a VIP Swap you must have at lease an application deployed to the Staging Slot. [Note: A deployment cannot be VIP swapped from Production to an empty Staging Slot.]

Windows Azure - VIP Swap

 

Windows Azure Accelerator for Web Roles

Although this functionality is not officially supported by Microsoft it provides the ability to quickly deploy or update multiple websites deployed to Windows Azure. If you overload your Web Roles by adding multiple Websites using the full IIS features in Windows Azure, this is definitely a no brainer.

image

The Windows Azure Accelerator for Web Roles deploys websites to a Windows Azure Storage account which is frequently polled by a Worker Process [overridden Run method in the RoleEntryPoint] in your Web Role. When changes are found in the Storage Account, the Worker Process pulls the new bits into the Directory in which the website is set up in IIS within your Windows Azure Web Role.

Keep in mind that the Windows Azure Accelerator for Web Roles is a solution that is deployed to the Web Role Instance, which means regardless of if you have an application deployed through it you will be playing for your instance to be deployed. The full time deployment of this Accelerator does give the advantage of a deployment time of mere seconds.

Conclusion

Hopefully this post has helped you understand how to potentially increase deployment times in Windows Azure.

Happy Clouding!

Must have NuGet Packages for Windows Azure Development

If you’re a Microsoft .NET Developer and haven’t yet heard of NuGet, you are missing out. NuGet is a Package Management System which allows for simple import, setup and upgrading of Third Party Software Packages. The best thing about NuGet is it isn’t limited to Third Party Software as it is possible to Create Packages and Custom Lists which makes it perfect for sharing code within a Company.

image

How does NuGet fit into Windows Azure Development?

To be honest, you can definitely do your Windows Azure Development without NuGet. Where the real power of NuGet comes in is the Configuration and Upgrading.

NuGet out-of-the-box allows for Configuration and Source Code Transformations which simplifies the process of using Community Contributions or Open Source Packages from other Software Venders.

When taking a dependency on a Third Party Component many projects never update to the newer bits of the packages they use.  These updated bits could contain important security or service updates which are ignored mostly because it’s too hard to upgrade or fear of breaking changes to their product.

While NuGet doesn’t ultimately mitigate the risk of breaking changes, it does allow for a more controlled upgrade to packages as the manufacturer of the package is handling the update process.

Windows Azure Awesomesauce in NuGet

To get the ball rolling Install NuGet, and execute your first command from the Powershell based Package Manager Console.

Get-Package –Filter Azure –ListAvailable

Results for "Get-Package -Filter Azure -ListAvailable"

This Query of Packages in NuGet containing reference to Windows Azure returns 34 Packages which can be used in your upcoming Windows Azure Projects.

My Windows Azure NuGet Package Recommendations

To set the stage here, I have only used a few of these packages in projects, but some of them are definite no brainers when it comes to future projects I work on. Let’s dig in and sweet what has been made much easier for us! [Note: the Headers are the actually installation commands from the Package Management Console]

Install-Package System.Web.Providers

The ASP.NET Universal Providers package is currently in a beta release. These extensions are to provide consistent Provider Support for Membership, Users, Roles, Profile and Session support regardless of Deploying to an On-Premise Server or in the Cloud using Windows Azure.

You can think of System.Web.Providers as the next generation of the original Windows Azure Samples found in Microsoft.Samples.ServiceHosting.AspProviders. The benefit this package will hopefully bring is a fully supported implementation of Role and Membership Management in Windows Azure Table Storage.

[Follow: System.Web.Providers]

Install-Package WindowsAzure.ServiceBus

This is the June 2011 CTP of the Windows Azure AppFabric Service Bus Features.

This package will install and enable interaction with Windows Azure AppFabric Topics or Queues. I’m looking forward to start diving into Topics and Queues for my upcoming presentation at SDEC2011.

[Follow: WindowsAzure.ServiceBus]

Install-Package WindowsAzure.WebRole.MVC3

Since the RTW of ASP.NET MVC 3.0 many developers have been tweeting, and asking questions on the Forums about an MVC3 Supported WebRole in the Windows Azure Tools. This hasn’t been added to the tooling to date, but you now have the ability to create MVC3 enabled Web Roles for your Windows Azure Deployments.

This package takes care of the Copy Local=true issue that many people have run into during their first deployment.

[Follow: WindowsAzure.WebRole.MVC3]

Install-Package WindowsAzure.Caching

Need to use the Windows Azure AppFabric Caching layer for one of your Web Applications? Look no further from this NuGet Package which will download the required Assemblies as well as pre-fill the web.config file to get you well on your way to using Windows Azure AppFabric Caching.

[Follow: WindowsAzure.Caching]

Windows Azure CDN Helpers

This one breaks the mold as there are two different types of packages for this one. If you’re a Web Forms Developer or an MVC Developer you’re both covered, but using separate packages.

Install-Package CdnHelpers.Razor

Provides a Razor Syntax for the Windows Azure Content Delivery Network (CDN).

[Follow: CdnHelpers.Razor]

Install-Package CdnHelpers.ASPX

Provides an ASP.NET Web Forms approach to Windows Azure Content Delivery Network (CDN).

[Follow: CdnHelpers.ASPX]

Install-Package EnterpriseLibrary.WindowsAzure.TransientFaultHandling

One of the important things to remember when dealing with Cloud Development is the possibility of failure. This package is a great find for anyone working with SQL Azure, Windows Azure Storage, or Windows Azure AppFabric.

There are a number of great implementations of Failure Retry Logic as well as a number of Extension Methods which allows quick additions to pre-existing code that currently doesn’t implement transaction retry logic.

[Updated: December 10, 2011]

[Follow: EnterpriseLibrary.WindowsAzure.TransientFaultHandling]

Install-Package EnterpriseLibrary.WindowsAzure.Autoscaling

Many people have been asking “Why won’t Microsoft Auto-scale my instances”, simply put, they know they’ll get it wrong as the application you build is unique to your industry. So to help people that would like the ability to auto-scale instances in Windows Azure Microsoft has released the Enterprise Library Blocks for Windows Azure.

This package in particular provides reusable components to add or manage auto-scaling capabilities in your Windows Azure Applications.

[Added: December 10, 2011]

Install-Package smarx.WazStorageExtensions

Steve Marx from the Windows Azure Team has created a great package that extends the Windows Azure Storage Client Library with additional functionality which isn’t available in the Official SDK.

If you use Blobs, Tables or Queues [from Windows Azure Storage] in your Windows Azure Application including the new Storage Analytics functionality this is an absolutely must have!

[Added: December 10, 2011]

Install-Package BareWeb.FluentAzureDiagnostics.dll

Diagnostics are important in understanding the state of your application while deployed to Windows Azure. Setting up Diagnostics using the Windows Azure SDK can be verbose and difficult to understand.

This package will help simplify and make your diagnostics configuration code easier to read for any developer that might be picking up your Windows Azure Application.

[Added: December 10, 2011]

[Follow: BareWeb.FluentAzureDiagnostics.dll]

Install-Package WindowsAzure.ELMAH.Tables

As important as ensuring that your Diagnostics are set up to monitor how Windows Azure is performing, it’s always a good idea to ensure that you’re logging your application for potential Issues. ELMAH is a set of Error Logging Modules And Handlers [for ASP.NET] which allows for a very simple and pluggable application error handling.

Just as ELMAH is necessary for your on-premise or shared hosted web applications, it remains just as essential to ensure logging is carried into the Cloud.

[Added: August 18th, 2011]

[Follow: WindowsAzure.ELMAH.Tables]

Install-Package WindowsAzure.ACS.Management

The Windows Azure ACS Identity Provider SDK provides a .NET wrapper for home realm discover against the Windows Azure Access Control Service.

[Added: December 10, 2011]

[Follow: WindowsAzure.ACS.Management]

Wrapping Up

Thanks for reading this post! If you enjoyed the tips in this post you might be interested in my post on creating the Ultimate Windows Azure Development VM (or Environment).

Happy Clouding!