Gaurav Mantri's Personal Blog.

Windows Azure Primer–Basics

There’re many articles which cover Windows Azure and it’s functionality in great details however I could not find much information when it comes to novice users (or may be I need to brush up on my searching skills Smile). Anyways, through these series of blog posts I will try and explain Windows Azure as I understand it to users who are just starting out with Windows Azure. We’ll cover some basic functionalities available in Windows Azure and try to understand that. If you’ve worked with Windows Azure, you may find these posts trivial but I still want you to read this so that you can correct me if I have provided some incorrect information.

With that intent, let’s start!

Before we get into the details about what Windows Azure and what it is not, let’s take a moment to define what Windows Azure is. I would define it like the following:

Windows Azure is Public Cloud Computing Platform offering by Microsoft

 

However before we talk about Windows Azure, let’s take a moment and talk about Cloud Computing first as I feel folks who are starting out have a different notion of what cloud computing is (and what it’s not). Then we get into Windows Azure.

Cloud Computing

In this section we’ll focus on cloud computing. We’ll start with definition, then talk about key characteristics of a cloud environment and then talk about some application scenarios where cloud can be used.

Definition

Wikipedia defines Cloud Computing as follows:

Cloud computing is the use of computing resources (hardware and software) that are delivered as a service over a network (typically the Internet)

However as I understand it (and at a very basic level):

It’s Just a Hosting Platform (with some differences)!

Let me explain. Let’s say I have built a website and now I want to host it. Depending on my application requirement, I may decide to go with a hosting provider and they would offer me different environments to choose from (Shared, VPS, Dedicated) to run my application; different storage options (disk quota, choice of data stores); bandwidth quota and some value added services etc. This is exactly the same with any cloud provider. At the very least, each cloud provider provides an environment to run the application (typically referred to as “compute”), choice of data stores (Relational, NoSql, Object) and network infrastructure (bandwidth, firewall etc.). So the application I would host with any hosting provider could easily be hosted with any cloud provider. There’re some differences and I’ll talk about those in the next section.

Key Principles/Characteristics

Any cloud computing infrastructure is built on the certain key principles and we talk about them below. Also I see a number of folks want to build their own cloud infrastructure (my advice to them: please, don’t! It’s bloody expensive Smile). So if you’re one the guys who want to build your own cloud infrastructure, make sure it has the characteristics described below.

Shared Resources

When you run your applications in your data centers, you own each and every part of it. You own the servers, you own the infrastructure, everything. However with cloud, it’s different. You don’t own anything there other than the application (and application data) you’re hosting.

Hosting an application in the cloud is quite similar to booking a room in a hotel.

You get a room which you rent for a few days. You can’t claim ownership of that room but at the same time you’re the only tenant in that room. In a cloud environment, you get one or more virtual machines in which you would run your applications but you don’t own those virtual machines. Like your hotel room, cloud provider would guarantee you that you’re the only tenant of those virtual machines. They won’t put more tenants in that virtual machine.

Hotel may offer other amenities (like Internet access, Gym, Restaurant etc.) but you share those amenities with other guests in the hotel. Similarly in a cloud environment, you share resources like internet bandwidth, physical infrastructure (like routers and stuff) with other tenants. Like you can’t have another guest sharing the same treadmill with you at the Gym Smile, cloud provider provides you with some isolation for these shared resources and ensures that you’re not impacted by “rude/noisy neighbor behavior” but that’s pretty much it.

Self-Service Model

All cloud provider provides a self-service model. As I understand it, a self-service model allows you to manage the resources you consume in a cloud environment by yourself without going to the cloud provider.

Again taking the analogy of the hotel, think of it that way: Let’s say you want to extend the reservation or may be change a room type. One way you could do it is to go to front desk and ask them to make those changes however that’s not the self-service model. Now let’s assume that the hotel provides a web site or a kiosk using which you can make the changes you want. Now that’s a self-service model.

Similarly in a cloud environment, each cloud provider provides a self-service model (either in form of raw API or through easy-to-use applications) using which you can manipulate the resources you want to consume e.g. you may want to run your application in a larger virtual machine or you want to increase (or decrease) the number of virtual machines in which your application runs. You don’t have to contact your cloud provider (by phone/email etc.) to do the same.

Another aspect of self-service model is “self healing”. Wouldn’t it be nice if the hotel automatically detects that your room is dirty and needs cleaning or you’ve run out of coffee in your room and automatically replenishes it! It doesn’t happen in hotel (at least in my experience) but it sure happens in the cloud. Through their advanced monitoring, a cloud provider knows that there’s something wrong with one or more virtual machines in which your application is running and it tries to heal them automatically. Self healing could happen in the form of taking out a troubled virtual machine out of the picture and spinning off a new virtual machine automatically.

Elasticity

In cloud computing, elasticity means the ability to expand or shrink resource consumption based on the need. It is sometimes related to scalability also. To give an example, let’s say you’ve an application which gets used more on weekdays than on weekends. In cloud environment you have the flexibility to put more resources (typically virtual machines) to serve your application during weekdays and then reduce the resources over the weekend. Combined with “self-service model” characteristic of the cloud infrastructure makes it quite attractive hosting choice for some kinds of applications (we’ll discuss that in a bit).

Another aspect of elasticity is the notion of infinite limit. To give you an example, when we buy a computer we get it with a hark disk with a pre-defined size e.g. 512 GB, 1 TB etc. Now we can’t go beyond that. If we need to go beyond that, we would either need to purchase an additional hard disk with higher capacity and replace the current one with a new one or get additional hard disk and attach it along with existing hard drive. But again there’s a limit to which you could go. In cloud you have the notion of infinite limit. You can increase as much as you want to.

I used the word “notion” and there’s a reason for that. It may seem like there’s no limit but in reality there’s one however generally speaking the limit is too high so we may never reach that limit.

Pay Per Use

Pay per use or consumption based billing is the most important characteristic of a cloud environment. In a typical cloud environment, you only pay for the resources you consume – nothing more, nothing less. So if you’re running a virtual machine for 12 hours, you only pay for 12 hours. This becomes really attractive for some companies (especially startups) because they don’t have to make upfront investment in procuring infrastructure. Today you need one server to serve your application, you use one server and you pay for just one. Tomorrow you need say ten servers to server your application, you use ten servers and you pay for those ten servers. Day after tomorrow you need again just one server, you use and pay for that one server.

When I talk to students about cloud computing, a common example I give is the computer buying experience. Let’s say you’re in the market for buying a computer and you don’t really need 4 GB of RAM or 512 GB of hard disk to begin with but then when you’re working on a special project you might need that kind of capability. You can’t tell your computer vendor that since you’ll be using a part of the resources available on the computer, you’ll only pay for that. They’ll laugh at you. You would either have to buy a low-end computer (and then worry about upgrading it later) or buy a high-end computer and underutilize it. Either way you look at it, you lose.

Not in cloud though!!! You need a low-end virtual machine to begin with, you go with that and pay a lower price for that (and only for the time you use) but then later on you need a high-end virtual machine, you just rent that high-end machine and use that and pay only for the time you use that machine. Makes complete sense, doesn’t it!

Key Application Scenarios/Patterns

Since a cloud computing infrastructure is a hosting environment and you could possibly host any kind of application there. However to take full advantage of the benefits offered by cloud, there’re a few key application scenarios/patterns. If your application fits those scenarios/patterns, then you may want to consider hosting your application in the cloud.

Here’re some of those scenarios/patterns:

On and Off Pattern

image

Let’s say you’re making a digital movie. Once the movie is complete, you would need massive compute capacity to create a render farm to render the movie. However once the rendering is done, you really don’t need that compute capacity. That’s “On and Off” pattern and cloud could be a perfect choice for that. Another example could be monthly data processing where you would need to generate lots and lots of reports for your clients however the whole exercise of generating reports is a few days task. This kind of application can also be considered to be deployed in the cloud.

Growing Fast Pattern

image

This is where typical startups come into picture. Let’s assume that you’re running a startup. Like every startup, you expect your startup to be extremely successful and wish to have millions of users using your application. As much as you want to do it, it’s impractical (both physically and financially) to start with having an infrastructure to support extreme load. So what you do is host your application in the cloud. If the startup is successful and you start getting more and more visitors, you just tap into “elastic” characteristic of your cloud provider and increase the resources really needed to support your user base.

Unpredictable Bursting Pattern

image

Everybody likes pleasant surprises. Let’s say you’re running a startup and unknown to you, suddenly you got “Techcrunched”!!! As a result, you see a sudden spike in the visitation to your application. Again the “elastic” characteristic of your cloud provider would allow you to increase the resources in no time to handle is unpredictable increase in load. Another example is that you’re providing an event management application as a service and one of the subscriber announces this really special event and that kind of catches you off guard. Having hosted this application in the cloud would give the ability and flexibility to meet with this unexpected demand.

Predictable Bursting Pattern

image

In one of my previous jobs, we developed a system where people would make reservations for camping sites all across the US. Summer time, especially long weekends (memorial day, labor day) were dreaded period for us because we knew that our application will be hammered badly on those days. Also there were some National Parks (like Yosemite National Park in California) which opened their booking on a particular date so we knew that we’ll get extensive load on that day. My only wish today is that we had cloud infrastructure during that time so that we didn’t have those nightmarish days and weekends Smile.

When you know well in advance that you would get more visitors on a particular day/time, you may want to consider cloud as a hosting option. You don’t have to build that excess capacity in-house just to take care of peak demand.

Another example I give here in India is Indian Railways train reservation website!!! They open their booking every morning at 8:00 AM and it is next to impossible to book a train ticket between 8:00 – 10:00 AM if you’re trying to book a train for summer vacation as everybody’s on that site. They could certainly use cloud, provision excess capacity for those two hours and have a lot of happy customers.

Windows Azure

Now that we’ve some basic understanding of cloud computing, let’s talk about Windows Azure. As I said above:

Windows Azure is Public Cloud Computing Platform offering by Microsoft

At a very high level it provides a compute environment to run your application, different storage options to store your application data and some value added services apart from core infrastructure. In this section we’ll briefly talk about these components (we’ll cover them in details in subsequent posts), answer the question if Windows Azure is right for your application and then answer some common questions (or debunk some myths). Plus we’ll also talk about how to get started with Windows Azure.

Components

First, let’s talk about components. In this post we’ll keep the discussion real short as we’ll cover them in great details in the subsequent posts.

Compute

This is the execution environment for your applications. Windows Azure provides both shared and dedicated execution environments with varied compute resource size (in terms of processing power, RAM etc.) and a wide range of operating systems (including but not limited to Windows Server 2012, 2008, some flavors of Linux etc.).

Storage

Every application either need to store some data or work on a stored data. Windows Azure provides many storage options including but not limited to Relational Databases (SQL Server, MySQL as a service), NoSql Databases (Table Storage) and Object Storage (Blob Storage). Through it’s Infrastructure as a Service (IaaS) offering, it is possible for you to support other relational and NoSql databases as well.

Value Added Services

This post is already quite long Smile so for the sake of not making it longer I’ve clubbed all other services under just one bucket – value added services. These include messaging (Windows Azure Queues/Service Bus), CDN, Caching, Identity Management (Windows Azure Active Directory/Windows Azure Access Control Service), Windows Azure Mobile Service, Windows Azure Media Service etc. It also offers a store which allows you to avail other value added services like monitoring etc. from 3rd party providers.

Is Windows Azure Right For Me?

I guess the right question to ask: “Is Cloud Right For Me?”. Simple answer to the question: it depends Smile.

Well, one criteria is the key scenarios/patterns described above. If your application fits one or more of the scenarios described above then yes you could consider Windows Azure.

Yet another criteria would be the application business domain. You would need to remember is that Windows Azure is Public Cloud and you don’t get physical access to the underlying infrastructure or data centers where your application is hosted. If your application business domain is constrained by certain rules and regulations (like HIPPA for healthcare, SOX for Finance etc.) you may want to check that first.

Also you would need to consider data sovereignty laws as Windows Azure does not have data center in every country/region. If your application has a requirement that the application data can’t leave the physical boundary of your country/region and Windows Azure does not have a data center in your country/region, you’re kind of out of luck! Windows Azure won’t stop you from hosting the application but then you would be in breach of your local laws.

Some Questions Answered

I participate in a number of forums and when people start with Windows Azure, they have some common set of questions. I’ve picked a few of them:

If I choose Windows Azure, do I let go of my existing skills and need to learn new ones?

No. Most folks think that cloud computing is yet another programming language they would need to master. Remember, Windows Azure is just another hosting platform for your application. You would still develop the application the way you’ve been developing them and when you’re ready to deploy your applications, you just deploy them in Windows Azure.

Obviously, to take full advantage of the platform you would need to learn some platform specific tricks but you don’t discard your existing skills. You learn new skills to complement your existing skills. One common example here is that when we build traditional web applications we either store images on the file system or in the application database. You could still do that but that’s not recommended as the file system in the cloud is volatile and there’re better alternatives than application database e.g. Blob Storage. So you would need to learn how to save images in blob storage.

A key benefit of Windows Azure is scalability however to achieve this you may have to build applications which have loosely coupled components (or modules) so that each component can be scaled independently. So in order to do that you may need to learn how to build loosely coupled components.

Isn’t Windows Azure all about .Net?

Absolutely not! Just because Windows Azure is from Microsoft we tend to assume that it’s all about .Net but that’s just not true. Windows Azure supports many languages and platforms including but not limited to .Net, Java, PHP, Python, Node.Js etc. If your programming environment is not supported natively you could still use Windows Azure by making use of IaaS feature.

Getting Started

Let’s wrap up this post by how to get started with Windows Azure. Well, Windows Azure offers a 90 day free trial which you can sign up for. You would be asked to provide a credit card number but it won’t be charged (with the exception of a $1.00 charge to verify your card) so it’s completely risk free. However you must realize that free trial comes with a preset quota for a month and if you exceed that quota, Windows Azure will suspend your account for the rest of that month. So please ensure that you don’t exceed that quota. You can avoid account suspension by removing the spending limit but during trial phase I would strongly recommend NOT to do that. This is one common mistake we do is not realize that in Windows Azure we pay based on consumption. We think that the consumption is the “consumption of our application” i.e. we only pay if somebody is using our application. That’s not true. Consumption is how much of Windows Azure’s resources are we consuming. When we deploy our application, we’re consuming virtual machines provided by Windows Azure. So please keep that in mind when using Windows Azure. To get started with Windows Azure free 90 day trial, please click here: http://www.windowsazure.com/en-us/pricing/free-trial/.

Windows Azure also provides a compute and storage emulator using which you can try some features without even signing up for the trial. So you may want to look into that as well. Compute and storage emulator are part of Windows Azure SDK which you can download from here: http://www.windowsazure.com/en-us/downloads/.

Other than that, I would strongly recommend going through development centers for different languages (http://www.windowsazure.com/en-us/documentation/) and trying out Windows Azure Training Kit (http://www.microsoft.com/en-US/download/details.aspx?id=8396). Please ensure that you’re downloading the latest training kit.

Summary

That’s it for this post. Pretty long post, eh!!! In the subsequent posts, we’ll explore functionality in greater details. As always, your feedback is most welcome. If I have made a mistake in the post, please let me know and I’ll fix it ASAP.


[This is the latest product I'm working on]