Building Hybrid Applications in the Cloud on Windows Azure
Most applications today are not simple; they may consist of many separate features that are implemented as services, components, third-party plug-ins, and other systems or resources. Integrating these items when all of the components are hosted locally in your datacenter is not a trivial task, and it can become even more of a challenge when you move your applications to a cloud-based environment.
For example, a typical application may use web and worker roles running on Windows Azure, store its data in SQL Azure databases, and connect to third-party services that perform tasks such as authenticating users or delivering goods to customers. However, it is not uncommon for an application to also make use of services exposed by partner organizations, or services and components that reside inside the corporate network that, for a variety of reasons, cannot be migrated to the cloud.
Applications such as this are often referred to as hybrid applications. This guide focuses on the common challenges you will encounter when building applications that run partly in the cloud and partly on-premises, or when you decide to migrate some or all elements of an existing on-premises application to the cloud. It focuses on using Windows Azure as the host environment, and shows how you can take advantage of the many features of this platform, together with the SQL Azure, to simplify and speed the development of these kinds of applications.
Building Hybrid Applications in the Cloud on Windows Azure is available in paperback from Amazon.com
This book is the third volume in a series about Windows Azure. Volume 1, Moving Applications to the Cloud,provides an introduction to Windows Azure, discusses the cost model and application life cycle management for cloud-based applications, and describes how to migrate an existing ASP.NET application to the cloud. Volume 2, Developing Applications for the Cloud, demonstrates how you can create from scratch a multi-tenant, Software as a Service (SaaS) application to run in the cloud by using the latest versions of the Windows Azure tools and the latest features of Windows Azure.
This guide focuses on applications that span the cloud and on-premises boundary, where some parts run in Windows Azure, while other parts are located inside the corporate network. It also describes how you can integrate these kinds of applications with external partners. The guide describes how a fictitious corporation named Trey Research migrated its on-premises Orders application to a hybrid application that interacts with external transport partners using many features and services available in Windows Azure and SQL Azure. It also includes a series of appendices that document the use cases and challenges typically encountered in hybrid applications, and provide guidance on the technologies for addressing these challenges.
Chapter 1, "The Trey Research Scenario" provides an introduction to Trey Research and its plan for evolving the on-premises Orders application into a hybrid application. It also contains overviews of the architecture and operation of the original on-premises application and the completed hybrid implementation to provide you with context for the remainder of the guide.
Chapter 2, "Deploying the Orders Application and Data in the Cloud" discusses the techniques and technologies Trey Research considered for deploying the application and the data it uses to the cloud, how Trey Research decided which data should remain on-premises, and the deployment architecture that Trey Research decided would best suite its requirements. The chapter also explores technologies for synchronizing the data across the on-premises and cloud boundary, and how business intelligence reporting could still be maintained.
Chapter 3, "Authenticating Users in the Orders Application" describes the technologies and architectures that Trey Research examined for evolving the on-premises application from ASP.NET Forms authentication to use claims-based authentication when deployed as a hybrid application.
Chapter 4, "Implementing Reliable Messaging and Communications with the Cloud" describes the technologies that Trey Research investigated for sending messages across the on-premises and cloud boundary, and the solutions it chose. This includes the architecture and implementation for sending messages to partners in a reliable way, as well as to on-premises services.
Chapter 5, "Processing Orders in the Trey Research Scenario" describes the business logic that Trey Research requires to securely and reliably process customers’ orders placed by using the Orders website. This logic includes directing messages to the appropriate partner or service, receiving acknowledgements, and retrying operations that may fail due to transient network conditions.
Chapter 6, "Maximizing Scalability, Availability, and Performance in the Orders Application" describes how Trey Research explored techniques for maximizing the performance of the Orders application by autoscaling instances of the web and worker roles in the application, deploying the application in multiple datacenters, and improving data access performance through caching.
Chapter 7, "Monitoring and Managing the Orders Application" describes the techniques that Trey Research examined and chose for monitoring and managing the Orders application. These techniques include capturing diagnostic information, setting up and configuring the Windows Azure services, and remotely managing the application configuration and operation.
The "Hybrid Challenge Scenarios" appendices focus on a more generalized series of scenarios typically encountered when designing and building hybrid applications. Each appendix addresses one specific area of challenges and requirements for hybrid applications, as described in Chapter 1, going beyond those considered by the designers at Trey Research for the Orders application. In addition to the scenarios, the appendices provide more specific guidance on the technologies available for tackling each challenge.
- Appendix A - Replicating, Distributing, and Synchronizing Data
- Appendix B - Authenticating Users and Authorizing Requests
- Appendix C - Implementing Cross-Boundary Communication
- Appendix D - Implementing Business Logic and Message Routing across Boundaries
- Appendix E - Maximizing Scalability, Availability, and Performance
- Appendix F - Monitoring and Managing Hybrid Applications
The guide is intended for any architect, developer, or information technology (IT) professional who designs, builds, or operates applications and services that run on or interact with the cloud. Although applications do not need to be based on the Microsoft Windows operating system to work in Windows Azure, this book is written for people who work with Windows-based systems. You should be familiar with the.NET Framework, Visual Studio, ASP.NET MVC, and Visual C#®.
These are the system requirements for running the scenarios:
- Microsoft Windows 7 with Service Pack 1 or later (32 bit or 64 bit edition), or Windows Server 2008 R2 with Service Pack 1 or later
- Microsoft Internet Information Server (IIS) 7.0
- Microsoft .NET Framework version 4.0
- Microsoft ASP.NET MVC Framework version 3
- Microsoft Visual Studio 2010 Ultimate, Premium, or Professional edition with Service Pack 1 installed
- Windows Azure SDK for .NET (includes the Visual Studio Tools for Windows Azure)
- Microsoft SQL Server or SQL Server Express 2008
- Windows Identity Foundation
- Enterprise Library 5 (required assemblies are included in the source code download)
- Windows Azure Platform cmdlets (install the Windows Azure Platform cmdlets as a Windows PowerShell snap-in, this is required for scripts that use the Azure Management API)
- Sample database (scripts are included in the Database folder of the source code)
Trey Research's Orders application enables visitors to place orders for products. It is a web application that has evolved over time to take advantage of the benefits of cloud-based deployment in multiple datacenters in different geographical locations, while maintaining some essential services and applications within the on-premises corporate infrastructure. This is a common scenario for many organizations, and it means that solutions must be found to a variety of challenges. For example, how will the application connect cloud-based services with on-premises applications in order to perform tasks that would normally communicate over a corporate datacenter network, but must now communicate over the Internet?
In Trey Research's case, some vital functions connected with the application are not located in the cloud. Trey Research's management and operations applications and some databases are located on-premises in their own datacenter. The transport and delivery functions are performed by separate transport partners affiliated to Trey Research. These transport partners may themselves use cloud-hosted services, but this has no impact on Trey Research's own application design and implementation.
When Trey Research originally created the Orders application it ran entirely within their own datacenter, with the exception of the partner services for transport and delivery. The application was created as two separate components: the Orders application itself (the website and the associated business logic), and the suite of management and reporting applications. It was designed in this way because Trey Research realized early on that these were two separate functional areas.
In addition, the public Orders web application would need to be able to scale to accommodate the expected growth in demand over time, whereas the management and reporting applications would not need to scale to the same extent. Trey Research proposed to scale the management and reporting applications as demand increases by adding additional servers to an on-premises web farm in their datacenter.
With the availability of affordable and reliable cloud hosting services, Trey Research decided to investigate the possibility of moving the application to Windows Azure. The hybrid Orders application works in much the same way as when it ran entirely on-premises.
The application allows customer to place orders for high-tech components and associated equipment, which Trey Research manufactures in its own factory and then ships to customers using third-party transport partners.
All customer requests pass through Windows Azure Traffic Manager, which redirects the customer to the instance of the Orders application running in the closest datacenter, based on response time and availability. Customers authenticate through Windows Azure Access Control Service (ACS) using a social identity provider such as Windows Live ID, Yahoo!, or Google.
Customer details are synchronized between the Customers table held in the on-premises database and SQL Azure in all the datacenters. This enables customers to access the application in any of the global datacenters Trey Research uses. The Orders application displays a list of products stored in the Products table. The Products data is kept up to date by synchronizing it from the master database located in the head office datacenter.
When a customer places an order, the Orders application stores the order details in the Orders table of the database in the local SQL Azure datacenter. All orders are synchronized across all Windows Azure datacenters so that the order status information is available to customers irrespective of the datacenter to which they are routed by Traffic Manager.
The Orders application also sends an advice message to the appropriate transport partner, depending on the delivery location, and sends audit information, such as orders over a specific total value, to the on-premises management and monitoring application for storage in a database located in the head office datacenter. When transport partners deliver the order to the customer they send a message to the Orders application so that it can update the Orders table in the database.
The third-party compliance application running in a Virtual Machine Role in the cloud continually validates the orders in the Orders table for conformance with legal restrictions and sets a flag in the database table on those that require attention by managers. It also generates a daily report that it stores on a server located in the head office datacenter.
To obtain management information, the on-premises Reporting application uses the Business Intelligence features of the SQL Azure Reporting service running in the cloud to generate reports from the Orders table. These reports can be combined with data obtained from the data market section of Windows Azure Marketplace to compare the results with global or local trends. The reports are accessible by specific external users, such as remote partners and employees.
This guide, like many patterns & practices deliverables, is associated with a community site. On this community site, you can post questions, provide feedback, or connect with other users for sharing ideas. Community members can also help Microsoft plan and test future guides, and download additional content such as extensions and training material.
An extension to this scenario has been developed for mobile users using Windows Phone 7 devices. For more details, see A Case Study for Building Advanced Windows Phone Applications.
Feedback and Support
Questions? Comments? Suggestions? To provide feedback about this guide, or to get help with any problems, please visit the Windows Azure guidance Community site. The message board on the community site is the preferred feedback and support channel because it allows you to share your ideas, questions, and solutions with the entire community. This content is a guidance offering, designed to be reused, customized, and extended. It is not a Microsoft product. Code-based guidance is shipped "as is" and without warranties. Customers can obtain support through Microsoft Support Services for a fee, but the code is considered user-written by Microsoft support staff.
Authors and Contributors
This guide was produced by the following individuals:
- Program and Product Management: Masashi Narumoto (Microsoft Corporation)
- Subject Matter Experts: John Sharp (Content Master), Eugenio Pace, Alex Homer, Scott Densmore, Clemens Vasters, Mark Scurrell, Jason Chen, Tina Stewart, Arun Rajappa, and Corey Sanders (Microsoft Corporation)
- Development: Scott Densmore (Microsoft Corporation), Jorge Rowies (Southworks), Alejandro Jezierski (Southworks),
- Test team: Hanz Zhang (Microsoft Corporation), Ravindra Mahendravarman (Infosys Ltd.), and Ravindran Paramasivam (Infosys Ltd.)
- Edit team: RoAnn Corbisier and Alex Homer (Microsoft Corporation) and John Sharp (Content Master)
- Book design and illustrations: John Hubbard (eson), Ellen Forney, and Eugenio Pace (Microsoft Corporation).
- Release Management: Nelly Delgado (Microsoft Corporation) and Richard Burte (ChannelCatalyst.com, Inc.)
We want to thank the customers, partners, and community members who have patiently reviewed our early content and drafts. Among those, we want to highlight the exceptional contributions of Kashif Alam, Vijaya Alaparthi, Matias Woloski, Eugenio Pace, Enrique Saggese, and Trent Swanson.
- Moving Applications to the Cloud, 2nd Edition
- Developing Applications for the Cloud, 2nd Edition
- A Guide to Claims-based Identity and Access Control, 2nd Edition
- Building Elastic and Resilient Cloud Apps - Developer's Guide to the Enterprise Library 5.0 Integration Pack for Windows Azure
- Enterprise Library 5.0 Integration Pack for Windows Azure
Last built: June 4, 2012