In the previous post in this series on Windows Azure we looked at Windows Azure Components. This week we will examine the parts that make up Windows Azure Compute.

Hosted services are applications that run on Windows Azure. Such services are made up of different resources that preform information processing, interact with the extern world and each other. Defined within services are two kinds of roles: Worker Roles and Web Roles.

Worker Roles are:

  • General purpose code host.
  • Often used for tasks which are long-running and non-interactive.
  • Able to host any type of workload.
  • Able to host entire applications including Microsoft Internet Information Services (IIS) or Apache Tomcat.

Web Roles:

  • Are special types of worker roles where IIS 7 is running by default.
  • Can host both web applications and web services.
  • Accept HTTP or HTTPS incoming requests through ports 80 and 443.
  • Have public ports (also known as public endpoints) which are automatically load balanced at the network level

Applications running in a web role can be deployed using any technology that works under IIS including ASP.NET and Windows Communication Foundation (WCF). The running of Hypertext Preprocessor (PHP) applications can also be accomplished with the use of the Fast CGI protocol. Web role applications are optimized to handle a request-reply pattern where usually the interval between requests is very short.

For the scalability of web roles, sessions will need to be managed since there is no certainty that users will be connected with the same web role instance each time they issue a request. For this purpose ASP.NET applications are able to store the state of a session. Alternatively, state information can be stored outside the web role in either SQL Azure, Windows Azure storage, in a cookie passed to the client or in hidden elements on a form.

Both roles are able to create outgoing TCP connections or open endpoints for connections coming in. When internal endpoints are opened by instances they are not load-balanced or publically visible to the Internet. In the cases where a virtual machine has both a web role and a worker role instances running there is also a Windows Azure agent running that makes available a Windows Azure FC API.

In Windows Azure, the most common application type is for a web role to handle incoming requests and use a Windows Azure queue to send them to a worker role to be processed. At regular intervals the worker role checks the queue and performs processing for waiting tasks. Then the worker role makes the completed task available from Azure storage.

In our next post we will explore the different kinds of storage available in Windows Azure.