Article Updated 1:- Simple 5 steps to run your first Azure program 2:- Simple 7 steps to run your first Azure Blob Program 3:- 7 simple steps to run your first Azure Queue program 4:- 9 simple steps to run your first Azure Table Program 5:- Simple 6 Steps to Run your First Azure Worker Role Program.
In case you want to refer step by step Azure learning material along with this complete article , here is the video which we have recorded for the same, - Video1.
Windows Azure FAQ Part 1
Different people have different obsessions and I have this stupid obsession of writing articles in FAQ formats :-) . The more I try to write articles in normal format I end up with a FAQ. My only thought process of writing articles in FAQ format is that we end up talking to the point rather than talking about trees and rivers , many may disagree.
Carrying my obsession one more step ahead Windows Azure FAQ part I.
Watch my 600+ videos on various topics like Design Patterns, WCF, WWF, WPF, LINQ, SilverLight, UML, SharePoint, Azure, VSTS and lot more @ click here , you can also catch me on my trainings @ click here.
- Simple 5 steps to run your first Azure program
- Simple 7 steps to run your first Azure Blob Program
- 7 simple steps to run your first Azure Queue program
- 9 simple steps to run your first Azure Table Program
- Simple 6 Steps to Run your First Azure Worker Role Program
I am really blessed to be part of Lionbridge SaaS team, the knowledge they brought within me about SaaS is incredible. I would not be writing this article if I was not the part of the team. Here’s nice article from the same team on SaaS http://www.lionbridge.com/lionbridge/en-US/kc/product-engineering/configurability-in-saas.htm .
The article by Modesty zhang really inspired me to write this article, here’s a reference http://www.codeproject.com/KB/silverlight/Azurelight.aspx , thanks for bringing the Azure interest in me.
At the initial stages of FAQ we will get acquainted to general vocabularies of Azure and then we will start with all programming stuff.
Quote: - Windows Azure is not a technological change, it’s a business change: - Shivprasad koirala (taking some space to glorify myself J )
If you really ask me Azure is 20% technological driven and 80 % business driven. So if you or your organization is thinking of migrating to Azure, the decision will be management driven rather than technology driven. So the initial stage of the article will talk about cost and need to use azure which will be a bit boring. As this FAQ series moves ahead you will see lot of samples codes, architecture thought process and all the technical blah blah.
I am sure as technological person you need to be aware of how to convince the management when you want to implement a new technology.
The best way to define Azure is by understanding what problem it solves. So let’s take a typical organization that has a separate IT department maintaining an online web application. Now let’s try to analyze which different cost factors are involved in maintaining a web application online.
We can divide IT department cost in to four broader sections:-
• Hardware cost: - If you want to host your web application you would need servers, routers etc to run your application.
• Software licensing cost: - When you make your application you will need to purchase server OS license like windows 2003 server, visual studio licenses, SQL server licenses etc.
• Hosting cost: - You also need to deploy your web application on internet. For that you will need to host your web application on some hosting service. One of the biggest costs in hosting service is bandwidth. So we need to budget for the same.
• IT personnel salary: - Nothing can be run without humans. So we also need IT personnel’s to do development and maintenance of code and infrastructure.
In other words there is a considerable cost attached to run an IT department. Many of these costs need to be paid up front.
The upfront cost can be solved if we can get a provider who can host a shared service which provides shared server hardware, shared software license cost and can provide pay per use bandwidth. The provider can maintain a team of IT personnel’s who can maintain the infrastructure. If the provider services not one but many organization using this shared service it can bring down the cost considerably.
So in other words the model changes something as shown below. So the provider moves all the hardware and software on a centralized location and the applications of the respective organization are hosted in this shared environment. Using this model organizations do not need to pay upfront for the hardware, software and IT personnel costs.
In one line to define Windows Azure, Microsoft is the provider and windows azure is the shared hosting service.
Microsoft has provided his own datacenters where they have hosted software's like SQL services,.NET services,Sharepoint services,Microsoft dynamic services and live services. Microsoft azure provides a cloud environment for running your web application and storing data. Its like visualizing windows services available on cloud.
Courtesy: - The above image is taken from the white paper
An Introduction to Microsoft® .NET Services for Developers: - The .NET framework for the cloud by Aaron Skonnard, Pluralsight. You can read the white paper from http://go.microsoft.com/fwlink/?LinkID=150833 .
Isn’t it friends, sharing cuts down cost J
As discussed above there are two types of cost one is the fixed cost (server hardware, employee salary etc) and other is the variable cost (bandwidth usage, hosting storage space etc).
Windows Azure services are billed using pay and use model. Microsoft terms this as consumption based model. In other words the customer does not need to pay anything upfront, everything is paid as per consumption.
The pay and use model is defined by four characteristics:-
• Compute / Hour: - Depending on how much computing power your application uses you will be charged. When I wrote this article it was $0.12 / hour.
• Storage in GB / month: - Storage is measured in units of average daily amount of data stored (in GB) over a monthly period. The storage cost currently is 0.15$ / GB stored for the whole month. Let’s try to understand the above statement. If you store 30 GB for a day then the average comes to 1 GB per month. If you stored 30 GB for 30 days then average come to 30 GB per month. Below are the calculation details :-
Figure :- Storage calculation details
• Bandwidth: - One more factor which is used to measure cost is bandwidth, in other words how much data goes in and out from the data centre. We will discuss on the bandwidth cost in more detail later because this has lot of variations depending on the services provided by Azure. Please note bandwidth used within data centre is free.
• Storage Transactions: - Any kind of add, update and delete on the storage data is also tracked. Currently it’s billed at $0.01 for 10,000 (10k) transaction requests.
The charges mentioned in this article can be obsolete as time passes by, for recent rate card please visit http://www.microsoft.com/azure/pricing.mspx
There are three parts to the Azure payment model:-
Metering: - This defines the unit of measurement. For example compute per hour, storage per GB, bandwidth per GB and transactions per 10k.
Billing: - This defines the dollar amount for the unit.
Services: - Both metering and billing needs to be associated with a service like .NET service, SQL Service, Live services etc.
The charges mentioned in this article can be obsolete as time passes by, for recent rate card please visit http://www.microsoft.com/azure/pricing.mspx
| ||Windows Azure ||SQL Azure ||.Net services |
|Bandwidth IN ||$0.10 / GB ||$0.10 / GB ||$0.10 / GB |
|Bandwidth OUT ||$0.15 / GB ||$0.15 / GB ||$0.15 / GB |
|Storage ||$0.15/GB stored/Month ||NA ||NA |
|Transactions ||$0.10/10000 K ||NA ||NA |
|Messages ||NA ||NA ||$0.15/100K message. |
A note of SQL Server cost
Web Edition – Up to 1 GB relational database = $9.99 / month
Business Edition – Up to 10 GB relational database = $99.99 / month
Before we start to answer this question, let’s thanks Steven Nagy for helping us understand this terminology http://azure.snagy.name/blog/?p=84.
As said before Microsoft has his own datacenter’s where they will have number of server’s running windows 2008 servers.
Note: - While I was writing this article what I understand is that currently they have one data centre in US west coast which hosts Windows Azure application.
The whole concept of Azure is to give decent hosting rates to the end user. So Microsoft has to somehow share his hardware across multiple applications.
In order to share the physical hardware across multiple applications, Microsoft used ‘Hypervisor’. Hypervisor is a modified version of Hyper-V. So hypervisor can help you to create virtual machines from those physical hardware servers. You basically end up with a cluster of nodes which can have virtual machine or hardware’s.
If you really expand these rectangle nodes you end up in to a Fabric like structure.
Figure: - Fabric
So now let’s define fabric. It’s nothing but a cluster of nodes. These nodes can have physical machines or virtual machines.
Our application run on the fabric nodes and each application gets its own virtual space resource. We will discuss about the same in more detail as we move ahead in the FAQ.
Fabric controller is the heart of the Azure fabric system. It manages complete life cycle of Azure services. Below are some important roles which Fabric controller plays:-
• Manages provisioning for the application. As per application needs fabric allocates CPU , memory and bandwidth limits.
• Deploy the services.
• Monitor system status and health. See that it satisfies the SLA’s defined.
• If there are failures recover from the same.
Roles are nothing but applications or components. To define the same in other words they are actually the application code. Windows Azure categorizes application in two categories one is the web application and the other is the worker application.
Web role / Web application: - A web role is a Web application which can be accessed via HTTP. A web role can be hosted as a subset of ASP.NET and Windows Communication Foundation (WCF) technologies.
Worker role / Worker process: - A worker role is a background processing application somewhat similar to a windows process. A worker role does not communicate directly with external the world. In other words it does not accept requests directly from the external world.
Yes, worker role cannot connect take inbound calls from internet but it can make outbound calls. A worker role is background processing process so it does not have incoming internet requests. Worker role also has access to queue services. So that can be one more communication point where external systems can post data and worker role can read from the same.
Figure: - Worker and Web role
Yes, every web role and worker role are hosted in their own virtual space or we can say in their own virtual machine. Fabric does not allocate IIS for worker role virtual machine.
You can see from the above figure how fabric controller uses the data centre hardware and creates new VM. Our application runs in those virtual machines. So if it’s a web role fabric controller will create a new VM instance with IIS and your web role instance. If it’s a worker role then it will create work role instance only. It will not provide IIS instance for worker role as its not supposed to take inbound calls from external world.
Every virtual machine has an agent. This agent facilitates communication between web and worker role instance with the fabric.
Till now we have only discussed about application code. With application you also need to save data. Windows Azure has three kinds of data blobs, tables and queues.
Blobs: - They are used to store large objects like images, audio, video etc.
Tables: - They are used to store durable and scalable data structure. Tables consist of entities and entities have properties.
Figure: - Table structure
Queues: - Queues are used enable asynchronous communication. They are enabled to store transient data in form of messages. Azure uses queues to communicate between different entities. For instance of a worker role and web roles wants to communicate they use queues.
We will be discussing the above 3 things in more detail in the coming FAQ series. We will be dedicating each one of them a complete FA series. Till then hold your breath.
No we cannot use standard SQL to query the above azure storages. They are accessed through REST (Representational state transfer). REST is a style of software architecture distributed systems. So if you want to read a data from a table you need to specify the below URL.
The first is the website on which the table is hosted , second is the table name and then your query.
REST relies completely on HTTP protocols which enables other languages like PHP.JAVA to communicate with Azure storages. In other words you can build your application using any language like CGI, PHP and have your data stored in Azure storage.
Windows azure will be using a common hosting platform so that cost of hosting is less for customers. In other words the storage should be highly scalable. In order to support these kinds of requirements we need to scale out and not scale up. Windows azure storage is built on scale out architecture.
Due to this SQL Server service is costly than azure storages. Let us try to understand why the cost increases because of Scale out architecture.
Scale up means when your database needs more processing power you just replace it with a more powerful processor. In other words you just buy more powerful processor with better RAM and put your application on the same. Because the numbers of processor do not change you are not charge with extra SQL Server licenses.
Figure :- Scale up
In scale out you add multiple servers as and when you need more processing power. Because news servers are added you also need to buy SQL Server licenses for each hardware. Azure is a scale out model. As per more processor needs Microsoft will add more hardware to his data centres. Due to more licenses the cost of SQL Server service will be higher as compared to windows azure storage.
Figure: - Scale out
So use Azure storage:-
• If your application is having a massive scale.
• You are not looking for rich relational data functionality like SQL, structured relational tables etc.
• You are looking for a less cost.
You need to use SQL Azure service
• Scalability is not the important factor.
• You are looking for rich database functionalities like SQL, structured relational tables etc.
• Cost is not a big matter.
• Start learning and prepare for Cloud course on Azure AZ - 900 Certification.
• SaaS configuration LionBridge whitepaper http://www.lionbridge.com/lionbridge/en-US/kc/product-engineering/configurability-in-saas.htm .
• The article by Modesty zhang really inspired me to write this article, here’s a reference http://www.codeproject.com/KB/silverlight/Azurelight.aspx
• An Introduction to Microsoft® .NET Services for Developers: - The .NET framework for the cloud by Aaron Skonnard, Pluralsight. You can read the white paper from http://go.microsoft.com/fwlink/?LinkID=150833 .
• Definition of the word fabric http://azure.snagy.name/blog/?p=84
• Awesome presentation which depicts the inside of windows azure infrastructure details http://mschnlnine.vo.llnwd.net/d1/pdc08/PPTX/ES19.pptx