nav-left cat-right
cat-right

Windows Azure – What is a Role?...

One of the core concepts in Windows Azure is the “role”. It is important to recognize that in Windows Azure, this term has a completely different meaning than a role in ASP.NET.  This post will briefly review what a role in ASP.NET represents. Then the term will be described in the context of Windows Azure.

ASP.NET Role

A role in ASP.NET represents a way to manage user authorization.  This approach helps you determine which pages in your ASP.NET application a user has access to. Roles are particularly useful when you are trying to manage which  groups of users need access to similar functionality. For instance, you may assign multiple users to an “administrator” role to give them access to more authoritative features in your application. If you would like to learn more about roles in ASP.NET please visit here.

The term role has a significantly different meaning in the world of Windows Azure however.

Windows Azure Role

A role in Windows Azure represents a single component built with managed code, that runs in the Azure environment.  This component comes in one of two flavors:

  • Web Role – Basically a web application (like an ASP.NET application).
  • Worker Role – Similar in behavior to a traditional Windows service application, meaning that it runs behind the scenes.

These two types of roles are the ones available at the time of this post. If you would like to learn more about roles in Windows Azure, please refer to the MSDN documentation here. If you are looking for more information, I personally recommend the easy-to-read book Azure in Action (my review is available here). I hope this short post helps you understand the purpose of a role within Windows Azure. If there are other questions you have regarding Windows Azure, please let me know in the comments.

What is a Compute Hour?...

One of the the things to consider when deciding if Windows Azure is right for your solution is pricing.  Windows Azure’s pricing is based on four factors: Computing, Storage, Storage Transactions, and Bandwidth.  The computing factor is priced on a per hour basis. This concept has raised the question “What is a compute hour?”

A compute hour is basically the duration at which a role instance runs.  A role instance represents either a Web Role or a Worker Role (an overview of each is provided here). Once deployed, each of these roles can have one or more instances running. This approach gives you the flexibility to quickly scale your application to use multiple instances if necessary.

As an example, imagine having a worker role that is responsible for processing electronically submitted orders. If this worker role was deployed for use in a smaller business, a single instance may be appropriate. If you were to keep this instance running for a single day, your compute cost would be calculated as:

1 (instance) x 24 (hours in a day) x .12 (cents per computer hour at the time of writing) =  $2.88

Now imagine that the orders start flowing in faster than your single instance can adequately handle. In less than 5 minutes you can have a second instance up and running.  Significantly, your cost only increases marginally as shown here:

2 (instances) x 24 (hours in a day) x .12 (cents per computer hour at the time of writing) = $5.76

You are only billed for role instances that are running. Because it is so easy to start and stop instances, you may choose to only use a role instance when you really need it. As an example, you may decide it appropriate to only run a role instance once a day, or once a week, or maybe just once a month. As you can imagine, the savings compared to purchasing a traditional server, or even using a virtual server, is quite significant.

I hope this helps explain what a compute hour is. If not, please let me know in the comments. If you would like to learn how to develop software on Windows Azure, I personally recommend the book Azure in Action. My review of this great book can be found here.