Azure: It’s not just a nice color
Windows Azure is Microsoft’s entry into the cloud. Microsoft was a little late to really get into the Cloud Computing party when compared to some cloud heavyweights like Amazon AWS (S3, EC2) and Google Apps/App Engine but nevertheless Windows Azure is a very strong entrant in its own right. It is intended to simplify IT management and minimize up-front and ongoing expenses. To this end, Azure was designed to facilitate the management of scalable Web applications over the Internet. The hosting and management environment is maintained at Microsoft data centers. Windows Azure can be used to create, distribute and upgrade Web applications without the need to maintain expensive, often underutilized resources onsite. New Web services and applications can be written and debugged with a minimum of overhead and personnel expense. Azure enables you to easily scale your applications up or down to any size. You only pay for the resources your application uses. Azure is deployed across multiple data centers around the world, enabling you to deploy your applications closer to your customers. The key value for Microsoft shops is that it has unique features for the .NET stack, and is very competitively priced compared to the market leader Amazon or others. It is a compelling value for Startups, smaller shops, or larger corporations who want to host an application (or a proof of concept) at a low entry price with high availability, and possible quick upward scaling.
Why we choose Windows Azure
For the client we implemented Azure for, we had previously built an ASP.NET web application that saw growing traffic; domestically and then internationally. Our client also wanted to expand their product base. We were hosted at the time on a beefy single box dedicated environment. This posed a teaser for technical team, on how the web site could be scaled with increased usage and how the web site will perform with increased data and traffic load. We wanted a hosting environment that would scale up with the increase of site usage and also scale out with the increase of data storage. Of course, we could move to a multi box environment with load balancing etc. but we were already paying large hosting fees for an application that had a lot of users but whose traffic patterns were sporadic (mainly geared around when new products/data came out). We felt it was a good time to look at Cloud computing as a good technical as well as economical alternative.
After doing the cost analysis for upgrading the physical web server and database server to get the performance and scalability, we decided to go for Cloud environment. (More details to come in a follow up post.) Here are some of the immediate benefits:
- Cloud allows you to decrease your costs for building and expanding your on-premises resources
- Depending on how you use it but especially for Platform as a Service or Infrastructure as a Service options, it really cuts down the maintenance and support side of traditional hosting with not having to deal with SQL Server maintenance, OS level patching, IIS settings etc.
- Dynamic scaling: based on increased usage of site we don’t have to invest in new servers, we can spin off new VM’s on an as-needed basis. You pay for what you use.
- Easy deployment with no downtime
- Add-on features like: Dedicated Caching processes, international regional availability, Data Analytics, Hybrid Services, etc.
- Data replication/backup etc. is behind the scenes and automatic
Once we decided that it was worth serious investigation, we decided to explore its use as a Disaster Recovery environment. Then we jumped right into the nuts and bolts. Below are some of our learnings.
Web application Migration Process:
Before you begin you should have installed Windows Azure SDK. You can click here to download Azure SDK.
Migrating existing ASP.Net application to run on Windows Azure platform is a 3 step process:
- Create New Windows Azure project (Open the Visual Studio in Administrator mode).
- Alter configuration values.
- Deploy the application to cloud environment.
Create New Windows Azure project:
- Open the Visual Studio in Administrator mode. Create a new project by clicking File–> New Project.
- Select C# –> Cloud –>Windows Azure Cloud Service
- Add “Roles” to your project. Our ASP.Net web application was using cache, so I created a new Azure project with 2 Roles a. Web Role b. Cache Worker Role (If you are not making use of shared Caching, then you don’t need this Role)
- To include existing web project you can skip above step and from the Solution explorer, right click to include you project as “Web Role”
- Create a cloud service using Quick Create
Alter configuration values
- Change configuration values like connection string pointing to correct database. If you are using Set the Number is instances to run in cloud
Deploy the application to cloud environment
Following are the steps you need to go through to deploy a cloud application using visual studio 2012.
Select the subscription and click Next
Select the Cloud Service, Environment, Build and Service configuration
Windows Azure Migration Gotchas!
Even though migration process to Azure is relatively simple there are some minor issues that can crop up because the Azure environment isn’t exactly the same as traditional environments. Here are some of the learnings while migrating the website.
- Error when passing string[] to webAPI method: I was passing string[] to a webAPI method and after the conversion, this code started throwing an error. Solution: Convert parameter type from string[] to dynamic.
- “Web.config transformation: Unrecognized attribute ‘xmlns:xdt’. Note that attribute names are case-sensitive” Error. Solution: Delete the content of “Obj” folder.
- “ErrorCode:SubStatus:The connection was terminated, possibly due to server or network problems or serialized Object size is greater than MaxBufferSize on server”. Solution: Before storing the objects in Windows Azure Cache, serialize the object and find out the size of it and if the size is above 8 MB, split the object into smaller chunks, may be byte arrays, etc and then store the byte arrays in Cache.
References:
- http://msdn.microsoft.com/en-us/library/windowsazure/hh694036.aspx#goodfit_benefits
- http://www.windowsazure.com/en-us/overview/what-is-windows-azure/