Archive for September, 2011

Windows Azure request Lifecycle

Posted: September 25, 2011 in Uncategorized

Continuing on my last blog Storage architecture in Windows Azure, I want to show how it works on windows azure, how your request is being processed on Windows Azure. We do have multiple type of storage on Windows Azure, however in your request you have to identify the URI of the object you want to access.

For example:

For the blob storage:

http:// <Your account name>.blob.core.windows.net/<the container name>/<the blob name>

For the table storage:

http://<Your account name>.table.core.windows.net/<table name>

For the queue storage:

http://<Your account name>.queue.core.windows.net/<queue name>

The second step is the work of the Front-End layer, it authenticates, authorizes, look in the partition map to get the partition server. Finally it sends the request to the corresponding server and also sends the response to the client.

Going to the third part which is the partition layer, before accessing the DFS( Distributed File System) to execute the request the partition layer has to make sure that the data is not cached in the partition server’s memory (it can process directly the request on the data in the memory rather than send requesting the data from the DFS).


 

Windows Azure Storage Architecture

Posted: September 22, 2011 in Uncategorized

In this blog I will cover how Windows Azure provides both the availability and the scalability to your application or your data stored on its datacenters. In one of my previous blogs about security I mentioned about the layer in the storage architecture which provides the authentication and the authorization.

That is the first layer in the storage architecture, the “Front-End layer”. The above layer has to deal with the all income traffic which means that it has to check if the incoming request has the authorization to access the data and then routes the request to the second layer, “Partition Layer”. To specify which partition server the request will go there is something called the partition map in the front-end layer to keep record which partition in the system is controlled by which partition server.

For the second layer, “Partition Layer”, it is responsible about all the partitions for the storage and the coming requests in the system. Just to clarify that all objects in the storage node has a partition key which can help accessing it and reaching by the coming requests. This layer is also about the management of the partition served by which partition server with a load balancing between the incoming requests to meet the traffic needs.

The third and the last layer, “Distributed and replicated file system”, this the layer in charge of storing the bits and replicating each data 3 replicates across many servers to maintain the high availability offered from the cloud solutions.


Picture taken from: http://blogs.msdn.com/b/windowsazurestorage/archive/2010/12/30/windows-azure-storage-architecture-overview.aspx

The Silverlight application is most of the time is hosted on a normal asp.net application that you can use it to add it to the Windows Azure Roles

Open Visual Studio and run it as administrator open a new project and go to Silverlight and create a normal one “Silverlight application”

Make sure you host your Silverlight application in an ASP.NET application for the following shown box

Now simply apply add a new project and include it into your current projects. Right click on your solution and add a cloud project but don’t add any roles just press “OK”

 

Now go to the folders named roles and right click and click on web Role in Solution you will find you available asp.net application where is hosted the Silverlight application. Now you can customize easily the Silverlight application and change in it as you like without worrying about the cloud.

 

 

Now your solution should like that with all the projects and roles in it.

Windows Azure Compute Node

Posted: September 11, 2011 in Uncategorized

In one of my following blogs I explained the difference between the 2 main roles Web Role and Worker Role. In this example I will show you how to use the 2 compute roles and to link between them using the queue storage.

First of all open your visual studio and run it as administrator because the azure tools require elevated permissions to work on your local machine.

Now on in your Visual Studio create a new project and choose the cloud under C#

Now press “OK” you will find another window open you will add the roles need available to be used for the development on Windows Azure.

In this Blog we will use main 2 roles:

  • ASP .NET Web Role
  • Worker Role

Now delete the 2 forms added in the webRole1 project “Default” and “About”, then add another form and let’s call it webform 1

We will add a textbox in the webapplication and a button. In the button’s code, I will show you how to use the queue storage to send a string for example to trigger a certain event to run on the server side consuming the processing power if the VMs.


<asp:TextBox
ID=”TextBox1″ runat=”server”></asp:TextBox>

 


<asp:Button
ID=”Button1″ runat=”server” onclick=”Button1_Click” Text=”Button”
/>

 

 

Now in the webRole1 we should add the required library to be able to develop on Windows Azure. So we will add the followings:

  • Microsoft.WindowsAzure.StorageClient
  • Microsoft.WindowsAzure.ServiceRuntime

 

Now add the following libraries in your cloud:

 

    using Microsoft.WindowsAzure;

using Microsoft.WindowsAzure.StorageClient;

using Microsoft.WindowsAzure.ServiceRuntime;

 

Create the connection String on both the web role and worker role. In the cloud project “WindowsAzureProject1” double click on the roles, under the setting tab click on add setting and create your connection string to be able to access your storage. In this example I will name it “ConnectionString”

 


 

 

Now in the method “Button1_Click” we will add the following code to send the string added on the text box to the worker role

protected
void Button1_Click(object sender, EventArgs e)

{


var account = CloudStorageAccount.FromConfigurationSetting(“ConnectionString”);


var queue = account.CreateCloudQueueClient().GetQueueReference(“QueueName”);

 


var msg = new
CloudQueueMessage(TextBox1.Text);

queue.AddMessage(msg);

}

 

Now we have finished the webrole side lets move on to the woker role side. Open the worker role and do the same with connection string part

 

To receive the queue message, we will add this code to the onStart() method:

 

 

string txt = “<text>”;


var account = CloudStorageAccount.FromConfigurationSetting(“ConnectionString”);


var queue = account.CreateCloudQueueClient().GetQueueReference(“QueueName”);

 


var msg = queue.GetMessage();


if (txt == msg.ToString())

{


//trigger event or call a method

}


else

{


//you can stop the worker role process

}

 


 

This Blog will show you all the requirements and the software needed to begin developing on windows Azure and make a “Hello World” website hosted on Windows Azure Platform. You must be running on windows 7 or windows server with IIS feature enabled.

First of All you need Windows Azure tools and SDK for any programming language and any environment. Then you need to configure your IIS on your machine to be able to run Windows Azure Emulator.

  • Open your Start menu and write in the search bar: “Turn windows features on or off” or you can get it from the Control Panel > Programs and features.

OR

 

 

Make sure you installed Visual Studio 2008 SP1 or later correctly with SQL Server 2005 or later.

Now you are ready to start building your first application on the Cloud. Run Visual Studio as Administrator

 

Now create a new project, press (Ctrl +Shift + N), then choose Cloud > Windows Azure Project

Then add an ASP.NET WebRole, which is a normal ASP.NET application using IIS

Then I will delete the forms existing (the default and the about forms). The n add a new web form. With a right Click at the “WebRole1”, add a new Web Form then press “OK”

In the new Web Form, add a new label with the following code under the <body>:

<form
id=”form1″ runat=”server”>

            Hello World!!!<br />

            <br />

            </form>

 

        

    Or Drag and drop a label from the toolbox

 

 

Press F5 and run your application, you will see the windows Azure Emulators starting at the taskbar and your website will run successfully.