61
Windows Azure Design Patterns David Pallmann GM Custom App Dev, Neudesic http://davidpallmann.blogspot.com @davidpallmann

Windows Azure Design Patterns

Embed Size (px)

DESCRIPTION

This is a presentation on the design patterns in Windows Azure, Microsoft's cloud computing platform.

Citation preview

Page 1: Windows Azure Design Patterns

Windows Azure Design Patterns

David PallmannGM Custom App Dev, Neudesichttp://davidpallmann.blogspot.com@davidpallmann

Page 2: Windows Azure Design Patterns

AGENDA

1. General Cloud Computing Patterns2. Patterns in the Windows Azure platform

ComputeStorageRelational DatabaseCommunicationSecurityNetwork

3. Cloud application patterns discussionDiscussion / Q & A

Page 3: Windows Azure Design Patterns

“Periodic Table” of Cloud PatternsPu Pr Hy Ia SaPa Ps Su

Ro In WoWe Vr Lb Ep Ei

Bl CoQm

Qu EnTa Pk Rk Ep

Ds Db Rd Sg FrSh FmRe

General

Compute

Storage

DB

Sb Sq To FiSuComm

Vn Rg MgNetwork

Ip Rp Ts Tk ClSecurity Ra

Cd Tm Rl Rf Rd

Ca

Page 4: Windows Azure Design Patterns

Part 1: General Cloud Patterns

Pu Pr Hy Ia SaPa Ps Su

Cloud Types Cloud Levels of Use Platform

PUBLIC CLOUD

PRIVATECLOUD

HYBRIDCLOUD

INFRASTR.AS A SVCE

PLATFORMAS A SVCE

SOFTWAREAS A SVCE

PLATFORMSERVICE

SUBSCRIP-TION

Page 5: Windows Azure Design Patterns

Public, Private, Hybrid Cloud

Public Cloud Private Cloud Hybrid Cloud

Pu Pr Hy

Page 6: Windows Azure Design Patterns

Public CloudAdvanced data center, global presenceOn-demand, elastic scale, well-managedMulti-tenant, consumption-based pricing

PuPUBLIC CLOUD

Page 7: Windows Azure Design Patterns

Private CloudOn-premises virtualization infrastructureShares some characteristics of public cloudUpcoming Windows Server 8 is able to virtually pool and allocate compute, storage, network resources in a multi-tenant fashion

Pr

YOUR CLOUD INFRASTRUCTURE

PRIVATECLOUD

Page 8: Windows Azure Design Patterns

Hybrid CloudConnect public cloud with private cloudIntegrate via VPN or other means

Hy

YOUR CLOUD INFRASTRUCTURE

CLOUD VENDORINFRASTRUCTURE

HYBRIDCLOUD

Page 9: Windows Azure Design Patterns

Ia SaPa

IaaS, PaaS, SaaS

“Bring Your Own VM“ “Bring Your Own App” “Bring Your Own User”

IaaSRaw Virtual Resources

PaaSApp Services Platform

SaaSJust Use It

INFRASTR.AS A SVCE

PLATFORMAS A SVCE

SOFTWAREAS A SVCE

Page 10: Windows Azure Design Patterns

Platform ServiceService provided by the cloud platformCompute Service

Run your software in the cloud data centerMost intimate level of cloud computingOther services generally usable in-cloud or on-prem

RESTful ServicesMost cloud services use HTTP RESTStorage, Communication, Management, …

Interop ServicesUse a specific protocol for interop / compatibilityExample: SQL Azure Database (TDS protocol)

PsPLATFORM

SERVICE

Page 11: Windows Azure Design Patterns

SubscriptionOngoing billing arrangementConsumption-basedServices used have pricing metersTypes

Month-to-monthTerm subscriptionNegotiated terms

Month-to-month is easy entry / easy exit without residual obligationsTerm or negotiated subscriptions can get you a discount in exchange for a commitment

SuSUBSCRIP-

TION

Page 12: Windows Azure Design Patterns

Part 2: Patterns Inherent in the Windows Azure Platform

Page 13: Windows Azure Design Patterns

Windows Azure ServicesCompute Service

Storage Service

Blob Storage

Queue Storage

Table Storage

SQL Azure Database

SQL Azure Reporting

Cache Service

Service Bus

Windows Azure Traffic Manager

Access Control Service

SQL Azure Data Sync Service

SQL Azure Import Export Service

Windows Azure Connect

DataMarket

CDN

S

PsPLATFORM

SERVICE

Page 14: Windows Azure Design Patterns

Fault & Upgrade DomainsFault domain

Spreads out your redundant servers / storage across the data center so a large failure doesn’t take out all of your resources

Upgrade domainHow patches or application updates are appliedUpgrades parts of your application in sequence (“red black pattern”) to maintain availability

DuDfFAULT

DOMAINUPGRADEDOMAIN

Page 15: Windows Azure Design Patterns

Fault Domains

& UpgradeDomains

UpgradeDomain 2

UpgradeDomain 3

UpgradeDomain 1

Fault Domain 3Fault Domain 2Fault Domain 1

Role AInstance 1

Role BInstance 1

Role CInstance 1

Role BInstance 2

Role CInstance 2

Role AInstance 2

Role CInstance 3

Role AInstance 3

Role BInstance 3

Page 16: Windows Azure Design Patterns

Compute Patterns

Roles

Ro In WoWe Vr Lb Ep Ei Ca

Endpoints Cache

ROLE INSTANCE WEBROLE

WORKERROLE

VMROLE

LOADBALANCER

INPUTENDPOINT

INTERNAL ENDPONIT

CACHESERVICE

Page 17: Windows Azure Design Patterns

Hosted ServiceYour app, hosted in Compute serviceConsists of one or more tiers (“roles”)Production & Staging deployment slots

Hs

ProductionDeployment

Slot

StagingDeployment

Slot

Windows Azure Regional

Data CenterHosted Service Project

Subscription

Page 18: Windows Azure Design Patterns

Roles & InstancesRole: a tier of your app (VM farm)Instance: VM, member of a role (5 sizes)Role has one or more instances (2+ for SLA)VM instances are volatile, roles are sturdy (like ants : colony or soldiers : army, you can lose an individual but the organization survives)

InRo

VM VM VM VM VM

ROLE INSTANCE

Page 19: Windows Azure Design Patterns

We

Web Role, Worker Role, VM Role

Configured with Windows Server, IIS &a public LB endpoint

Upload your app

PaaSManaged

Auto patched

Configured with Windows Server

Upload your app

PaaSManaged

Auto patched

You prepare a VM

Upload a full VM

IaaSYou Manage

No auto-patching

Web RoleWeb Container

Worker RoleGeneral-purpose Container

VM RoleVM Image

VrWoWEBROLE

WORKERROLE

VMROLE

Page 20: Windows Azure Design Patterns

EndpointsAllows access to a roleLoad balancer: round-robinInput (public) endpoint: public, load-balancedInternal endpoint: only accessible by cloud app

EiEp

VM VM VM VM VM

LbLOAD

BALANCERINPUT

ENDPOINTINTERNALENDPOINT

Page 21: Windows Azure Design Patterns

Deployment Patterns DiDp

HOSTED SERVICE

APPLICATION RUNTIME

FILES

Compute Service

SERVICE METADATA

HOSTED SERVICE

CUSTOM VM IMAGE

Compute Service

SERVICE METADATA

Paas Deployment IaaS Deployment PAASDEPLOYMENT

IAASDEPLOYMENT

Page 22: Windows Azure Design Patterns

ComputePatternsExample VM VM VM

Web Role Com

pute TierW

orker Role Compute Tier

Public Endpoint

Queue

VM VM VM

Page 23: Windows Azure Design Patterns

Cache ServiceCache ServiceDistributed Memory CacheAvailable in different sizesSame programming model as Windows Server Cache (“Velocity”)

CaCACHE

SERVICE

Page 24: Windows Azure Design Patterns

Windows Azure Compute

Attendee Bee Conference AppHTML5/Mobile ASP.NET/MVC web sitehosted in a Web Role

Demo

Page 25: Windows Azure Design Patterns

Storage Patterns

Bl CoQm

Qu EnTa Pk Rk Ep

Blob Storage Queue Storage Table Storage

BLOB CONTAINER QUEUEMESSAGE

QUEUE TABLE ENTITY PARTITIONKEY

ROWKEY

ENTITYPROPERTY

Page 26: Windows Azure Design Patterns

Primitive Storage vs. Database

Ratio of primitive : relational data is frequently higher in the cloudCheap: pennies per gigabyte/moScale: no practical size limitSimple: less complexity / overheadLighter: optimistic concurrencyTrendy: fueled by trends in cloud / mobile arch/ & movements like NoSQL

Page 27: Windows Azure Design Patterns

Bl

Blob, Queue, & Table Storage

Use for anything you would normally use a

file for

For queuing task messages

Structured data where you don’t need

relational features

Blob StorageFile-like

Queue StorageSimple queues

Table StorageBig, cheap tables

TaQuBLOB QUEUE TABLE

Page 28: Windows Azure Design Patterns

Blob StorageBlob: File-like storageContainer: Holds blobs, like folderName, data, metadataSequential/streamed accessSimple put/get operationsData stored with redundancyProvides persistence for VMsDirectly reference blobs as URIs2 kinds of blobs:block (sequential), page (random)

CoBlBLOB CONTAINER

Page 29: Windows Azure Design Patterns

Queue StorageQueue: holds messagesMessages small string or XML contentAccess semantics may differ from enterprise queue technologies you are used toEnterprise reasons to use queues also apply in the cloudCan use queues to load-balance workersCan use queues to coordinate work across rolesStrict FIFO not guaranteed due to queue semantics

QmQuQUEUE QUEUE

MESSAGE

Page 30: Windows Azure Design Patterns

Table StorageBig, cheap data tablesSimple record-oriented storageTable: hold entities (records)Entity: contains properties (fields)Does not enforce a schemaNo relational featuresPartition Key + Row Key = a unique key

EnTa

RkPkEn Ep Ep Ep:

TABLE ENTITY

ENTITY PARTITIONKEY

ROWKEY

ENTITYPROPERTY

ENTITYPROPERTY

ENTITYPROPERTY

Page 31: Windows Azure Design Patterns

Storage Examples

IMAGES

MEDIA CONTAINER

VIDEO XML

20 GB

1000 40 40

WEB ORDERS

ORDER QUEUE

PHONE ORDERS

COUNTRY (PK)CUSTOMER ID (RK)LAST NAMEFIRST NAMESTREETCITYSTATEPOSTALPHONEEMAIL

CONTACTS TABLE

Page 32: Windows Azure Design Patterns

Windows Azure Storage

AttendeeBee Conference AppBlob & Table Storage

Demo

Page 33: Windows Azure Design Patterns

Relational Data Patterns

Db Db Rd ShSg FrRe Fm

Database ReportingService

Data SyncService

FederationService

DATABASESERVER

DATABASE REPORTDEFINITION

REPORTENDPOINT

SYNCGROUP

SYNCHUB

FEDERATIONROOT

FEDERATIONMEMBER

Page 34: Windows Azure Design Patterns

Db

Relational Database Services

Sql Azure DatabaseDatabase Service

Sql Azure ReportingReporting Service

SQL Azure Data SyncSynchronization Service

Sy

Rs

Sql Azure FederationsDatabase Federation Service

Fr

DATABASESERVICE

REPORTSERVICE

SYNCSERVICE FEDERATION

SERVICE

Page 35: Windows Azure Design Patterns

SQL Azure DatabaseRelational DB as a serviceOne master and two replicants, auto failoverPhysical management handled for youHas most SQL Server features but not allSize limit of 150GBDatabase Server: virtual DB server (actually 3)Database: database contained in a DB server

DbDsDATABASE

SERVERDATABASE

Page 36: Windows Azure Design Patterns

SQL Azure ReportingDB reporting as a serviceSimilar experience to SSRSSource is SQL Azure DatabaseUse BIDS to create reports, RDF formatRd: report definitionRe: web-accessible reporting endpoint

ReRdREPORT

DEFINITIONREPORT

ENDPOINT

Page 37: Windows Azure Design Patterns

SQL Azure Data Sync1-way or bi-directional syncingSQL Azure to SQL AzureSQL Azure to SQL ServerHub and spoke model: all syncing is to and/or from the hub SQL Azure databaseCan trigger a sync manually or scheduleSync: Synchronization operationSync group: Defines group of DBs for syncingSync hub: the hub of the sync group

ShSgSYNC GROUP SYNC HUB

Page 38: Windows Azure Design Patterns

SQL Azure FederationsDatabase federationPartition or shard to multiple databases, have a “federation database” that looks like one DBFederation Root: federation root databaseFederation Member: member database

FmFrFEDERATION

ROOTFEDERATION

MEMBER

Page 39: Windows Azure Design Patterns

Database Service

Accessing & Managing a SQL Azure Database

Demo

Page 40: Windows Azure Design Patterns

Communication Patterns

Sb Sq To FiSu

Service Bus Service Bus Queues

SERVICEBUS

SERVICE BUSQUEUE

TOPIC SUBSCRIP-TION

FILTER

Page 41: Windows Azure Design Patterns

Service BusUsing the cloud as acommunication relayNavigates NATs, firewalls, proxies wellSupports client-service, eventing/pub-sub messaging patternsVolatile (best effort) messaging

SbSERVICE

BUS

Page 42: Windows Azure Design Patterns

Service Bus QueuesService Bus Queue: Durable messagingTopic: publish point for durable messagingSubscription: receiver of durable messagingFilter : criteria on which messages to receive

Sq

Su

To

Fi

SERVICE BUSQUEUE

TOPIC

SUBSCRIP-TION

FILTER

Page 43: Windows Azure Design Patterns

Service Bus

T-Shirt WorldUsing a Service Bus Queue toRelay Orders for Processing

Demo

Page 44: Windows Azure Design Patterns

Networking Patterns

Vn Rg Mg

VPN Connection

Cd

CDN

Tm

Traffic Manager

Rl Rf Rd

VIRTUALNETWORK

ROLEGROUP

MACHINEGROUP

CONTENTDELIVERYNETWORK

TRAFFICMANAGER

LOCALE-BASEDROUTING

FAILOVERROUTING

DISTRIBUTEDROUTING

Page 45: Windows Azure Design Patterns

VPN ConnectionWindows Azure ConnectVirtual Network: VPN connection between cloud and on-prem machinesRole Group: indicates which roles are members of a virtual networkMachine Group: indicates which on-prem machines are members of a virtual network

Vn

Mg

Rg

VIRTUALNETWORK

ROLEGROUP

MACHINEGROUP

Page 46: Windows Azure Design Patterns

Windows Azure Connect ExampleASP.NET web site in the cloud accessing on-prem SQL Server DB

S

WEB ROLE

S

3

S

SQL SERVER DATABASE

Page 47: Windows Azure Design Patterns

CDNContent Delivery NetworkCDN: Utilizes worldwide network of 24+ edge server to deliver content efficientlyOften used for mediaLocale-directed DNS goes to nearest node to serve up cached contentContent sources from blob storage or your hosted service

CdCONTENTDELIVERYNETWORK

Page 48: Windows Azure Design Patterns

Traffic ManagerWindows Azure Traffic ManagerTraffic Manager: Routes DNS access to your hosted service to one of several possible deployments based on rulesLocale-based Routing: route to a deployment based on localeFailover Routing: route to a secondary if primary is not healthy (via a heartbeat)Distributed Routing: route based on a desired distribution across data centers

Tm

Rl

Rf

Rd

TRAFFICMANAGER

LOCALE-BASEDROUTINE

FAILOVERROUTING

DISTRIBUTEDROUTING

Page 49: Windows Azure Design Patterns

Security Patterns

Ip Rp Ts

Claims-based Security

Tk Cl Ra

IDENTITYPROVIDER

RELYINGPARTY

SECURITYTOKEN

SERVICE

TOKEN CLAIM REDIRECTEDAUTHENTICATION

Page 50: Windows Azure Design Patterns

Claims-based SecurityModern way to do AuthN/AuthZUse with web identity, domain identityIdentity Provider: Party providing security token with claimsRelying Party: application that wants to authenticate/authorize userSecurity Token Service: how application/user authenticates (interactively or programmatically)Redirected Authentication: user visits app, user redirected to STS to sign in, redirected back to app with token

Ip

Ts

Rp

Ra

IDENTITYPROVIDER

RELYINGPARTY

SECURITYTOKEN

SERVICE

REDIRECTEDAUTHENTICATION

Page 51: Windows Azure Design Patterns

Claims-based SecurityWeb Identity

S

WEB ROLE

S

2+

Windows Azure

RP ACS

Google

Yahoo!

Live ID

Page 52: Windows Azure Design Patterns

Claims-based SecurityDomain Identity

S

WEB ROLE

S

2+

Windows Azure

RP

ADFS

AD

Enterprise

Page 53: Windows Azure Design Patterns

Part 3: Cloud Application Patterns

Page 54: Windows Azure Design Patterns

Competing ConsumersCan “load balance” back end of worker roles using queues

Worker Role

Queue

Page 55: Windows Azure Design Patterns

Use Queues to Coordinate RolesFront end can submit tasks for the back endBoth front end and back end can be scaled to accommodate load

Web Role

Worker Role

Q

Page 56: Windows Azure Design Patterns

CQRS PatternCommand/Query Responsibility SegregationBest for large implementationsSeparate read& write

WEB FARM CQRS-READS

PUBLIC CLOUD

WEB FARM CQRS-WRITES

CLUSTERED / PARTITIONED DB

FILES, QUEUES

RELATIONAL DATA

NON-RELATIONAL DATA

You probably don’t do the same amount of eachTake advantage of lightweight read mechanismsSafer – avoid accidental updates/deletes

Page 57: Windows Azure Design Patterns

Modern Web Solutions“Connected Devices, Continuous Services”

HTML5 M

OBILE

SOCIA

L CLOUD

Page 58: Windows Azure Design Patterns

Modern Web ApplicationDECENTRALIZED BACK END

Business Services

Application

TABLET

CLOU

D

HETEROGENEOUS FRONT END

DESKTOPBROWSER

PHONE

Identity Services

IP

Data Stores

Platform Services

Directories

PartnerServices

PARTNER

Data Stores

Page 59: Windows Azure Design Patterns

Modern Web Application

Attendee Bee Conference AppOpen, Mobile, Global, & Social

Demo

Page 60: Windows Azure Design Patterns

Discussion – Cloud PatternsPu Pr Hy Ia SaPa Ps Su

Ro In WoWe Vr Lb Ep Ei

Bl CoQm

Qu EnTa Pk Rk Ep

Ds Db Rd Sg FrSh FmRe

General

Compute

Storage

DB

Sb Sq To FiSuComm

Vn Rg MgNetwork

Ip Rp Ts Tk ClSecurity Ra

Cd Tm Rl Rf Rd

Ca

Page 61: Windows Azure Design Patterns

Windows Azure Design Patterns

David PallmannGM Custom App Dev, Neudesichttp://davidpallmann.blogspot.com@davidpallmann

Thanks!