ARC206: Patterns for Cloud Computing

ARC206: Patterns for Cloud Computing

Patterns For Cloud Computing David Gristwood Application Architect Microsoft http://blogs.msdn.com/david_gristwood/ @ScroffTheBad Session Objectives Session Objectives Provide you with 5 patterns for cloud-based applications Show implementations of these patterns

Patterns for Cloud Computing #1 - Using the Cloud for Scale #1 - Using the Cloud for Scale Wow! What a great site! Request Browser Web Tier Response B/L Tier

Databa se #1 - Using the Cloud for Scale Browser Browser Browser Web Tier Browser Server Busy Browser

B/L Tier Databa se #1 - Using the Cloud for Scale Browser Browser Browser Browser Browser Web Tier B/L Tier Timeout

Databa se #1 - Using the Cloud for Scale How would you do this today on premises? Browser Browser Browser Browser Browser N L B Web Tier

Web Tier Web Tier B/L Tier Databa se #1 - Using the Cloud for Scale How would you do this today on premises? Browser Browser Browser Browser Browser

Web Tier N L B B/L Tier B/L Tier B/L Tier Databa se

#1 - Using the Cloud for Scale How would you do this today on premises? Browser Browser Browser Browser Browser N L B Web Tier Web Tier Web

Tier N L B B/L Tier B/L Tier B/L Tier Databa se #1 - Using the Cloud for Scale

How would you do this today on premises? Browser p1 p2 p3 Browser Browser Browser Browser N L B Web Tier Web

Tier Web Tier N L B B/L Tier B/L Tier B/L Tier Databa se

Not without consequences... #1 - Using the Cloud for Scale How would you do this today on premises? Browser p1 p2 p3 Browser Browser Browser Browser N L B

Web Tier Web Tier Web Tier N L B B/L Tier B/L Tier B/L

Tier That took a lot of time, effort and money! Databa se #1 - Using the Cloud for Scale How would you do this today on premises? p1 p2 p3 Not so great now Browser

N L B Web Tier Web Tier Web Tier N L B B/L Tier

B/L Tier B/L Tier That took a lot of time, effort and money! Hmmm... Most of this stuff is sitting idle... Databa se #1 - Using the Cloud for Scale Datacenter peak load

Idle time Usage Jan Apr Jul Oct How can cloud computing help? #1 - Using the Cloud for Scale

Wow! What a great site! Request Browser Web Role Response Worker Role Azure Storag e #1 - Using the Cloud for Scale

Browser Browser Browser Web Role Browser Server Busy Browser Worker Role Azure Storag

e #1 - Using the Cloud for Scale Browser Browser Browser Browser N L B Web Role Web Role Web

Role Browser You dont see this bit Worker Role Azure Storag e #1 - Using the Cloud for Scale Browser Browser Browser

Browser Browser N L B Web Role Web Role Web Role N L B

Worker Role Worker Role Worker Role Azure Storag e OK, so changing config is easy... but what else do I need to know? #1 - Using the Cloud for Scale Browser

Browser Browser Browser Browser N L B Web Role Web Role Web Role N

L B Worker Role Worker Role Worker Role Azure Storag e #1 - Using the Cloud for Scale Browser Browser

Browser Browser Browser N L B Web Role Web Role Web Role N L

B Worker Role Worker Role Worker Role Tight coupling between web and worker role is an antipattern Azure Storag e #1 - Using the Cloud for Scale

4. Process Worker Role Web Role 2. Respond to UI 1. Place on queue Re q 3. Pickup from queue Queue

#1 - Using the Cloud for Scale 4. Process Worker Role Web Role Re q 5. Add result to table Queue

6. Query table on refresh Table Demo #1: Prime Solver How many web and worker roles do you need? How many web and worker roles do you need? #1 - Using the Cloud for Scale Browser Browser Browser Browser

WMI_Win32_PerfFormattedData_ASPNET_ASPNETApp lications /RequestsPerSecond Web Role N Azure Web Worker L Storag Role Role B e Web

Role Browser Log Worker Role Management API or Email How many web and worker roles do you need? #1 - Using the Cloud for Scale Web Role Web Role

Worker Role Web Role Re q Re q Re q Queue Web Role Web Role

Web Role Monitor queue length against users expectations #1 - Using the Cloud for Scale Worker Role Worker Role Worker Role Web Role Web Role

Web Role Re q Re q Re q Queue Web Role Web Role Web Role Monitor queue

length against users expectations Worker Role Worker Role Worker Role Patterns for Cloud Computing Takeaways A core tenet of cloud computing is the ability to scale up & down Understand how to communicate between roles

and nodes Strategy on when to scale up/down roles in production Patterns for Moving to the Cloud #2 - Using the Cloud for Multi-Tenancy #2 - Using the Cloud for Multi Tenancy How would you do this today on premises? Browser Web Tier B/L Tier

Databa se Web Tier B/L Tier Databa se Web Tier B/L Tier Databa se

Customer #1 Browser Customer #2 Browser Customer #3 Gets expensive pretty quickly #2 - Using the Cloud for Multi Tenancy What you really want is this: Browser Customer #1

Browser Customer #2 Browser Customer #3 Web Tier B/L Tier Databa se Schema Customizations UI Customizations

Schema Customizations UI Customizations 3 options for data in multi tenant environment #2 - Using the Cloud for Multi Tenancy Browser Customer #1 Browser Customer #2 Browser Customer #3

Fixed Schema Web Tier B/L Tier Databa se Option 1: Everyone Uses the Same Database/Schema Pros: Simplest approach, easy to maintain/ upgrade. Cons: No customizations. Restoring of tenant data.

#2 - Using the Cloud for Multi Tenancy Browser Customer #1 Browser Customer #2 Browser Customer #3 Web Tier B/L Tier Databa

se Customer #1 Databa se Customer #2 Databa se Customer #3 Option 2: Give Each Customer Their Own Database/Schema Pros: Flexible. Tenant restore is easier. High Isolation. Cons: Can be costly. Difficult to upgrade db

schemas. #2 - Using the Cloud for Multi Tenancy Fixed Schema with Customizations Browser Customer #1 Browser Customer #2 Browser Customer #3

Web Tier B/L Tier Databa se Option 3: Fixed Database/Schema, with customizations Pros: Customers can add their own custom fields Cons: Non standard way of customizing the schema. Tenant restore is difficult. #2 - Using the Cloud for Multi Tenancy Tenant

1 TenantID int TenantName nvarchar * * EmployeeId *

Type Employee TypeID int int FirstName nvarchar Name nvarchar LastName nvarchar

CLRType nvarchar 1 1 Customization CustomizationID * Value int nvarchar

* #2 - Using the Cloud for Multi Tenancy Tenant 1 Fixed Schema Applies to All Tenants * TenantID int TenantName nvarchar

* EmployeeId * Type Employee int Customizable Tenant by Tenant Basis FirstName nvarchar

LastName nvarchar TypeID int Name nvarchar CLRType nvarchar 1 1

Customization CustomizationID * Value int nvarchar * #2 - Using the Cloud for Multi Tenancy Tenant 1

1 TenantID * TenantNameUK Branch * * Type Employee TypeID

1 EmployeeId 1 FirstName Gordon Name PostalCode LastName Brown

CLRType string 1 1 Customization CustomizationID * Value 1

* SW1A 2AA #2 - Using the Cloud for Multi Tenancy Tenant 1 TenantID 2 * TenantNameUS Branch

* * Type Employee TypeID 2 EmployeeId 2 FirstName

Barack Name ZipCode LastName Obama CLRType string 1 1

Customization CustomizationID * Value 2 20500 * Schema Customizations UI Customizations #2 - Using the Cloud for Multi Tenancy

Browser Customer #1 Browser Customer #2 Browser Customer #3 Web Tier B/L Tier Databa se

URL Handing using MVC routing #2 - Using the Cloud for Multi Tenancy Browser Customer #1 Browser http:// hr.contoso.co.uk http:// employeedata.cloudapp.net Web Tier B/L Tier Customer

#2 Browser Customer #3 http:// hr.fabrikam.com Databa se #2 - Using the Cloud for Multi Tenancy Browser Customer #1 Browser

http://hr.contoso.co.uk -> CNAME (employeedata.cloudapp.net) http:// employeedata.cloudapp.net Web Tier B/L Tier Customer #2 Browser Customer #3 http://hr.fabrikam.com -> CNAME (employeedata.cloudapp.net)

Databa se #2 - Using the Cloud for Multi Tenancy Browser http://hr.contoso.co.uk -> CNAME (employeedata.cloudapp.net) Customer #1 Browser http:// employeedata.cloudapp.net Web Tier

B/L Tier Customer #2 Browser Use custom route to controller mapping Customer #3 http://hr.fabrikam.com -> CNAME (employeedata.cloudapp.net) Databa se

Demo #2: Multi Tenant Schema and UI Patterns for Cloud Computing Takeaways Always consider Multi Tenancy first, even if only one customer Design considerations must include both data and UI Many other considerations, such as identity Patterns for Moving to the Cloud #3 - Using the Cloud for Compute

#3 - Using the Cloud for Compute Worker Data Client Master Worker Worker Data Data

Data #3 - Using the Cloud for Compute Resul t Client Master Resul t Resul t

Worker Worker Worker Resul t Popularized by the term MapReduce* * 2004 OSDI paper by Jeff Dean and Sanjay Ghemawat (Google) #3 - Using the Cloud for Compute How many es in The quick brown fox jumps over the lazy dog? Worker

Data Client Master Worker Worker M M M

Map M M M #3 - Using the Cloud for Compute L Client Master

L Resul t 3 x es found Worker Worker Worker L Reduc

e L L L And its definitely popular... #3 - Using the Cloud for Compute Google 20pb of data analyzed every day using MapReduce Yahoo! 10k+ cores, 4pb of data using MapReduce Facebook 2500+ cores, 1pb of data using MapReduce

And there are several frameworks #3 - Using the Cloud for Compute C++, C#, Erlang, Java, Python, Ruby, F#, R, Apache Hadoop Open Source Java Inspired by MapReduce (Core, HDFS, many more) Amazon Elastic MapReduce Hadoop implementation on EC2 #3 - Using the Cloud for Compute How would you do this today on premises? Worker Data

Client Master Soc ket s Client ApplicationJob/Task Scheduler Worker Worker Data Data

Data Remote Service How about implementing this on Windows Azure? #3 - Using the Cloud for Compute Data Client Data Worker Worker

Web Role Worker Client ApplicationJob/Task Scheduler Data Data Remote Service Re q Queue

Table Demo #3: Windows Azure Demo Inspired by MapReduce Patterns for Cloud Computing Takeaways MapReduce very visible, although can be difficult to initially grasp Learn about existing frameworks, especially Apache Hadoop Read up on Dryad (DryadLINQ) for future direction Patterns for Moving to the Cloud

#4 - Using the Cloud for Storage #4 - Using the Cloud for Storage How would you do this today on premises? File Client RPC/NFS File Server Store

#4 - Using the Cloud for Storage How would you do this today on premises? Data Client TDS (Tabular Data Stream) DB Server RDB MS #4 - Using the Cloud for Storage How would you do this today on premises? Data

Browser HTTP POST Web Server Datab ase #4 - Using the Cloud for Storage I love you too!

I love you! Server Data Affinity between your data and physical hardware that serves it #4 - Using the Cloud for Storage I love you too! I love

you! Server Data Symptoms: Which RAID number was that again? Tedious to backup exponentially growing data Damn! Im at 95% capacity - got to move to a bigger disk How does the cloud help? Breaks the affinity between your data and hardware

Blobs, Tables, Relational Blobs, Tables, Relational #4 - Using the Cloud for Storage Blob PutBlob PUT Container http://account.blob.core.windows./net/containername/blobna REST API me Client Azure Blob Storage

http://account.blob.core.windows.net/containername/blobnam #4 - Using the Cloud for Storage Blob Container REST API Client Azure Blob Storage GetBlob GET http://account.blob.core.windows./net/containername/blobna me

http://account.blob.core.windows.net/containername/blobnam Range: bytes=329300 - 730000 #4 - Using the Cloud for Storage PutBlock(blobname, blockid, data) PutBlockList(blobname, blockid1, , blockidN) REST API Client Blob Container Azure

Blob Storage http://account.blob.core.windows.net/containername/blobnam Blobs, Tables, Relational #4 - Using the Cloud for Storage REST: GET http://account.table.core.windows.net/Customer?$filter=%20PartitionKey %20eq%20value LINQ: var customers = from o in context.CreateQuery(Customer) where o.PartitionKey == value select o; Worker Role

Azure Table Storage http://account.table.core.windows.net Each Table: PartitionKey (e.g. DocumentName) to ensure scalability RowKey (e.g. version number) as application key [fields] for data as name / value pairs Blobs, Tables, Relational #4 - Using the Cloud for Storage For easy migration, this is what I would like to do...

Data Client TDS SQL Azure RDB MS #4 - Using the Cloud for Storage Queue HTTP Browser

Web Role Worker Role TDS SQL Azure RDB MS Migration: #4 - Using the Cloud for Storage The Data Center TDS

HTTP Browser Web Tier Bus. Logic SQL Server RDB MS #4 - Using the Cloud for Storage The Cloud

Queue HTTP Browser Web Role Worker Role TDS SQL Azure RDB MS Demo #4: SQL Azure

Patterns for Cloud Computing Takeaways Storage in the cloud may look the same, but breaks the affinity issue Understand the pricing model for storage on-premises vs. cloud SQL Azure as a factor for migration/move from on premises Patterns for Moving to the Cloud #5 - Using the Cloud for

Communications #5 - Using the Cloud for Communications Company 1 Telco provided WAN Company 2 Server Client FTP Client FTP

Server #5 - Using the Cloud for Communications Company 1 Internet Telco provided WAN Company 2 Server Client FTP Client

FTP Server #5 - Using the Cloud for Communications Company 1 Internet Telco provided WAN Company 2 DMZ Server Client Browser

Extranet Site What does the cloud provide? #5 - Using the Cloud for Communications Company 1 Client http://app.queue.core.windows.net/ REST Azure Queue Company 2 Client

#5 - Using the Cloud for Communications Company 1 Client x http://app.queue.core.windows.net/ REST Company 2 Client Security? Shared keys?

Azure Queue #5 - Using the Cloud for Communications Company 1 Client http://app.queue.core.windows.net/ REST Web Role Company 2 Client Azure Queue

#5 - Using the Cloud for Communications Company 1 Proxy? Firewall Client http://app.queue.core.windows.net/ REST Web Role Company 2 Client Firewall

Azure Queue #5 - Using the Cloud for Communications Company 1 Firewall Client http://app.queue.core.windows.net/ REST Web Role 65.55.33.204 Company 2 Client 192.168.14.100

Firewall NAT? Azure Queue #5 - Using the Cloud for Communications Company 1 Firewall Client http://app.queue.core.windows.net/ REST Web Role 65.55.33.204

Company 2 Client 192.168.14.100 Firewall OK, so Ill do a HTTP poll every minute Azure Queue #5 - Using the Cloud for Communications Company 1 Firewall Client

http://app.queue.core.windows.net/ REST Web Role 65.55.33.204 Company 2 Client 192.168.14.100 Firewall and how about other protocols other than HTTP? Azure Queue How does the Azure AppFabric Service Bus

help? #5 - Using the Cloud for Communications Company 1 Client sb://.../myqueue AppFabric Service Bus Company 2 Client #5 - Using the Cloud for Communications

Company 1 Client sb://.../myqueue AppFabric Service Bus Company 2 Client Firewall Outbound bi-directional socket Kept alive in background #5 - Using the Cloud for Communications Company 1

Client Firewall sb://.../myqueue Outbound one-way socket AppFabric Service Bus Company 2 Client Message routed accordingly Firewall Outbound bi-directional socket

Kept alive in background Patterns for Cloud Computing Takeaways Be careful consuming REST based queues using shared secret Firewalls/NATs can add additional trouble (especially non-HTTP) Learn how AppFabric Service Bus traverses in these scenarios Patterns for Moving to the Cloud Putting the patterns

together Putting the Patterns Together Windows Azure PHP Lets build an application in PHP that scales to many nodes Putting the Patterns Together Use Use the the principles principles of of

multi multi tenancy tenancy to to create create a a version version of of the the application application across across multiple multiple vendors vendors

Windows Azure PHP (10 nodes) Google AppEngine Java Servlet Amazon EC2 ASP.NET (5 nodes using ELB) Putting the Patterns Together

Windows Azure PHP Job Client Job Google AppEngine Java Servlet Job Amazon EC2 ASP.NET

Compute results with a MapReduce-like way of distributing work across all of these Putting the Patterns Together Store the results in a SQL Azure database Job Client Job

Windows Azure PHP Google AppEngine Java Servlet Job Amazon EC2 ASP.NET SQL Azure Databas e

Putting the Patterns Together .NET Service Bus Windows Azure PHP Job Client Job Google AppEngine Java Servlet Job

Coordinate Coordinate communication communication through through the the AppFabric AppFabric Service Service Bus Bus Amazon EC2 ASP.NET SQL

Azure Databas e Putting the Patterns Together AppFabric Service Bus Windows Azure How How many many prime prime numbers numbers between

between 1 1& & 10,000,000? 10,000,000? Job Client Job Job 40 jobs of 250,000 numbers PHP

Store results in SQL Azure Compute Google AppEngine Java Servlet Compute Amazon EC2 ASP.NET Compute SQL Azure

Databas e Demo #5: Prime Solver v2.0 Next Steps Next Steps Head up to www.Azure.com . . . . . Next Steps 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Recently Viewed Presentations

  • mentor.ieee.org

    mentor.ieee.org

    11k Cairns Agendas Date: 2005-05-13 Authors: Notice: This document has been prepared to assist IEEE 802.11. It is offered as a basis for discussion and is not binding on the contr
  • cs412slides

    cs412slides

    Chapter 1. Introduction Why Data Mining? What Is Data Mining? A Multi-Dimensional View of Data Mining What Kinds of Data Can Be Mined? What Kinds of Patterns Can Be Mined?
  • Host Family Orientation - Academic Year in America

    Host Family Orientation - Academic Year in America

    Students have medical and accident insurance through AYA. Students and host families will receive an insurance card and a brochure detailing the policy coverage when they arrive in the U.S. Unless it is necessary, try to have your student go...
  • C++ new/delete CSE 333 Spring 2018

    C++ new/delete CSE 333 Spring 2018

    Administrivia. Yet another exercise released today, due Wednesday. Rework exercise 10 but with dynamic memory this time. Fine to use ex10 solution as a starting point for ex11
  • S3 Bronze Duke of Edinburgh Award Parent information

    S3 Bronze Duke of Edinburgh Award Parent information

    edofe login site. Timeframes. In class. Timeframe. DofE is more than an expedition! You achieve an Award by completing your own programme of activities in four sections: Volunteering Physical Skills Expedition.
  • Czech Feature Film since 1989: The Context:

    Czech Feature Film since 1989: The Context:

    Czech Feature Film since 1989: The Context: The 1960s: "Czech New Wave" ... aggressive males Jan Hřebejk´s Cosy Dens (1999) Relations between men and women Man the fantasist, chcípák, the intellectual vagrant-outsider Tomáš Vorel´s The Stone Bridge (1996) Relations between...
  • Clinical Indicators of Diagnoses - ACDIS

    Clinical Indicators of Diagnoses - ACDIS

    Clinical indicators of diagnoses. ... Risk adjustment is a corrective tool used by actuaries to level the playing field regarding the reporting of patient outcomes, adjusting for the differences in risk among specific patients ... Every code assigned should be...
  • City and Hackney Clinical Commissioning Forum Thursday 7th

    City and Hackney Clinical Commissioning Forum Thursday 7th

    Vitamin B12 Deficiency - Dr Manisha Sharma . An email advert will be send out in September with an Eventbrite link to book this session. ADVERT. CCG Specific Commissioning ... A Tier 3 children's obesity service to be commissioned as...