Welcome!

Web 2.0 Authors: Esmeralda Swartz, Pat Romanski, Michael Bushong, Kevin Benedict, Alex Forbes

Related Topics: Cloud Expo, .NET, Virtualization

Cloud Expo: Article

Design Patterns in the Windows Azure Platform

Multi-Tiered Development Using Windows Azure Platform

While most  Cloud Platforms are viewed as Virtualization, Hypervisors, Elastic Instances and infrastructure-related flexibility that enables you to arrive at the dynamic infrastructure,  Windows Azure is a complete development platform where the  scalability of the multi-tiered systems can be enabled through the usage of  ‘Design Patterns'.

Below are the  common ‘Design Patterns' that can be realized using the Windows Azure as a PaaS platform.

Web Role & Worker Role
Windows Azure currently supports the following two types of roles:

  • Web role: A web role is a role that is customized for web application programming as supported by IIS 7 and ASP.NET.
  • Worker role: A worker role is a role that is useful for generalized development, and may perform background processing for a web role.

A service must include at least one role of either type, but may consist of any number of web roles or worker roles.

Role Network Communication|
A web role may define a single HTTP endpoint and a single HTTPS endpoint for external clients. A worker role may define up to five external endpoints using HTTP, HTTPS, or TCP. Each external endpoint defined for a role must listen on a unique port.

Web roles may communicate with other roles in a service via a single internal HTTP endpoint. Worker roles may define internal endpoints for HTTP or TCP.

Both web and worker roles can make outbound connections to Internet resources via HTTP or HTTPS and via Microsoft .NET APIs for TCP/IP sockets.

So  we can have a  ASP.NET front end application hosted on a VM which is a web role and a WCF Service hosted  VM which is a worker role and the following design patterns can be applied.

Session Facade
Worker Role VM
as a facade is used to encapsulate the complexity of interactions between the business objects participating in a workflow. The Session Facade manages the business objects, and provides a uniform coarse-grained service access layer to clients.

The below diagram shows the implementation of Session Façade pattern in Windows Azure.

Business Delegate / Service Locator
The Business Delegate reduces coupling between presentation-tier clients and business services. The Business Delegate hides the underlying implementation details of the business service, such as lookup and access details of the Azure / Worker role architecture.

Service Locator object abstracts server  lookup, and instance creation. Multiple clients can reuse the Service Locator object to reduce code complexity, provide a single point of control, and improve performance by providing a caching facility.

These two patterns together provide valuable  support for Dynamic Elasticity and Load Balancing in a cloud environment. We can have logic in these roles (Business Delegate, Service Locator) such that the Virtual Machines with the least load are selected for Service and  providing higher scalability.

Typical Activities that can be loaded to a Business Delegate Worker Role are:

  • Monitoring Load Metrics using APIs for all the other Worker Role VMs
  • Gather and Persist Metrics
  • Rule Based Scaling
  • Adding and Removing Instances
  • Maintain and Evaluate Business Rules for Load Balancing
  • Auto Scaling
  • Health Monitoring
  • Abstract VM migration details from Web Roles

Other Patterns
Windows Azure's  coarse grained, asynchronous architecture of Web Roles and Worker Roles facilitates several other common design patterns mentioned below, which makes this a robust enterprise development platform and not just a Infrastructure Virtualization Enabler.

  • Transfer Object Assembler
  • Value List Handler
  • Transfer Object
  • Data Access Object
  • Model View Controller Architecture
  • Front controller
  • Dispatcher View

Summary
Design patterns help in  modularizing software development and deployment process , so that the building blocks can be developed independently  and yet tied together without much tight coupling between them. Utilizing  them for the  Windows Azure development will compliment the benefits already provided by the Cloud platform.

More Stories By Srinivasan Sundara Rajan

Srinivasan Sundara Rajan (Also Known As Sundar) Is A Enterprise Technology Enabler for realizing business capabilities. His primary focus is enabling Agile Enterprises by facilitating the adoption of Every Thing As A Service Model with particular concentration on BpaaS (Business Process As A Service). He also helps enterprises in getting meaningful insights from their structured and unstructured and real time data sources. All the views expressed are Srinivasan's independent analysis of industry and solutions and need not necessarily be of his current or past organizations. Srinivasan would like to thank every one who augmented his Architectural skills with Analytical ideas.