Patterns For Cloud Computing

189

description

Covers five patterns for cloud computing, showing implementations using Windows Azure

Transcript of Patterns For Cloud Computing

Page 1: Patterns For Cloud Computing
Page 2: Patterns For Cloud Computing

Patterns for Cloud Computing

Page 3: Patterns For Cloud Computing

This is Jim

Patterns for Cloud Computing

Page 4: Patterns For Cloud Computing

Jim has many questions about cloud computing

Patterns for Cloud Computing

Page 5: Patterns For Cloud Computing

The more he reads, the more confused he gets

Patterns for Cloud Computing

Page 6: Patterns For Cloud Computing

“What is Cloud Computing?”

Patterns for Cloud Computing

Page 7: Patterns For Cloud Computing

“What can I use the Cloud for?”

Patterns for Cloud Computing

Page 8: Patterns For Cloud Computing

“What is Microsoft’s roadmap in this space?”

Patterns for Cloud Computing

Page 9: Patterns For Cloud Computing

Answering these Questions can be Difficult

Page 10: Patterns For Cloud Computing

Answering these Questions can be Difficult

So many alternative definitions from

different vendors

It can be difficult to describe what

the cloud can be used for

Keeping up with our beta and

released products is challenging

Page 11: Patterns For Cloud Computing

Session Objectives

Page 12: Patterns For Cloud Computing

Session Objectives

Explore a Clear Definition

of Cloud Computing

Arm you with 5 Patterns for

Cloud-based Applications

Show you how to Implement these

Patterns using our Platform

Page 13: Patterns For Cloud Computing

Defining Cloud Computing

Page 14: Patterns For Cloud Computing

Defining Cloud Computing

Jim has heard all the buzzwords

Page 15: Patterns For Cloud Computing

Defining Cloud Computing

Service Oriented Architecture

Page 16: Patterns For Cloud Computing

Defining Cloud Computing

Rich Internet Applications

Page 17: Patterns For Cloud Computing

Defining Cloud Computing

Software as a Service

Page 18: Patterns For Cloud Computing

Defining Cloud Computing

Software + Services

Page 19: Patterns For Cloud Computing

Defining Cloud Computing

Are any of these cloud computing?

Page 20: Patterns For Cloud Computing

Defining Cloud Computing

Styles of application architecture

Page 21: Patterns For Cloud Computing

Defining Cloud Computing

These styles can work in the cloud,

but they are not cloud computing

Page 22: Patterns For Cloud Computing

Defining Cloud Computing

Where do your applications “live”?

Page 23: Patterns For Cloud Computing

Defining Cloud Computing

On Premises

Hosted

Cloud

Page 24: Patterns For Cloud Computing

Defining Cloud Computing

Application runs

on-premises

Buy my own

hardware, and

manage my own

data center

Application runs

on-premises

• Bring my own

machines,

connectivity,

software, etc.

• Complete control

and responsibility

• Upfront capital

costs for the

infrastructure

Page 25: Patterns For Cloud Computing

Defining Cloud Computing

Application runs

on-premises

Buy my own

hardware, and

manage my own

data center

Application runs at a

hoster

Pay someone to

host my application

using hardware that

I specify

Application runs

on-premises

• Bring my own

machines,

connectivity,

software, etc.

• Complete control

and responsibility

• Upfront capital

costs for the

infrastructure

Application runs at a

hoster

• Rent machines,

connectivity,

software

• Less control, but

fewer

responsibilities

• Lower capital costs,

but pay for fixed

capacity, even if idle

Page 26: Patterns For Cloud Computing

Defining Cloud Computing

Application runs

on-premises

Buy my own

hardware, and

manage my own

data center

Application runs at a

hoster

Pay someone to

host my application

using hardware that

I specify

Application runs using

cloud platform

Pay someone for a

pool of computing

resources that can

be applied to a set

of applications

Application runs

on-premises

• Bring my own

machines,

connectivity,

software, etc.

• Complete control

and responsibility

• Upfront capital

costs for the

infrastructure

Application runs at a

hoster

• Rent machines,

connectivity,

software

• Less control, but

fewer

responsibilities

• Lower capital costs,

but pay for fixed

capacity, even if idle

Application runs using

cloud platform

• Shared,

multi-tenant

environment

• Offers pool of

computing

resources,

abstracted from

infrastructure

• Pay as you go

Page 27: Patterns For Cloud Computing

Defining Cloud Computing

Cloud “Variants”

Page 28: Patterns For Cloud Computing

Defining Cloud Computing

Public Cloud

Page 29: Patterns For Cloud Computing

Defining Cloud Computing

Pool of computing resources offered by

a vendor, typically using a

“pay as you go” model

Page 30: Patterns For Cloud Computing

Defining Cloud Computing

Private Cloud

Page 31: Patterns For Cloud Computing

Defining Cloud Computing

Pool of computing resources that lives

within a self managed datacenter

Page 32: Patterns For Cloud Computing

Defining Cloud Computing

Pool of computing resources that lives

within a datacenter with no sharing

Page 33: Patterns For Cloud Computing

Defining Cloud Computing

“What is Microsoft doing in Cloud Computing?”

Page 34: Patterns For Cloud Computing

Defining Cloud Computing

Refer to the introductory Azure

materials – not going to go through

them here

Page 35: Patterns For Cloud Computing

Defining Cloud Computing

3 x Critical Concepts

Page 36: Patterns For Cloud Computing

Defining Cloud Computing

Roles

Web Role

Worker Role

Page 37: Patterns For Cloud Computing

Defining Cloud Computing

Storage

Table, Blob, Relational

Page 38: Patterns For Cloud Computing

Defining Cloud Computing

Messaging

Queues

Page 39: Patterns For Cloud Computing

Patterns for Cloud Computing

Using the Cloud for Scale

Page 40: Patterns For Cloud Computing

“Isn’t the cloud good for applications that need to

scale dynamically?”

Patterns for Cloud Computing

Page 41: Patterns For Cloud Computing

For example, tax applications

Patterns for Cloud Computing

Page 42: Patterns For Cloud Computing

“How does this work?”

Patterns for Cloud Computing

Page 43: Patterns For Cloud Computing

Let’s do some white boarding for Jim…

Patterns for Cloud Computing

Page 44: Patterns For Cloud Computing

…and when I say white boarding, I really mean it

Page 45: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web TierBrowserRequest

B/L Tier DatabaseResponse

“Wow! What a great site!”

Page 46: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Tier B/L Tier DatabaseBrowser

Browser

Browser

Browser

Browser

“Server Busy”

Page 47: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Tier B/L Tier DatabaseBrowser

“Timeout”

Browser

Browser

Browser

Browser

Page 48: Patterns For Cloud Computing

How would Jim do this today on premises?

Page 49: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Tier B/L Tier DatabaseBrowser

Browser

Browser

Browser

Browser

Web Tier

Web Tier

N L B

How would Jim do this today on premises?

Page 50: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

DatabaseBrowser

Browser

Browser

Browser

Browser

Web Tier B/L Tier

B/L Tier

B/L Tier

N L B

How would Jim do this today on premises?

Page 51: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

DatabaseBrowser

Browser

Browser

Browser

Browser

B/L Tier

B/L Tier

B/L Tier

N L B

Web Tier

Web Tier

Web Tier

N L B

How would Jim do this today on premises?

Page 52: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Browser

Browser

Browser

Browser

Browser

B/L Tier

B/L Tier

B/L Tier

N L B

Database

p1 p2 p3

Web Tier

Web Tier

Web Tier

N L B

How would Jim do this today on premises?

Page 53: Patterns For Cloud Computing

Not without consequences...

Page 54: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Browser

Browser

Browser

Browser

Browser

B/L Tier

B/L Tier

B/L Tier

N L B

Database

p1 p2 p3

Web Tier

Web Tier

Web Tier

N L B

“That took a lot of work - and money!”

How would Jim do this today on premises?

Page 55: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Browser B/L Tier

B/L Tier

B/L Tier

N L B

Database

p1 p2 p3

Web Tier

Web Tier

Web Tier

N L B

“Not so great now…”

“Hmmm... Most of this stuff is sitting idle...”

“That took a lot of work - and money!”

How would Jim do this today on premises?

Page 56: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Usage

Jan Apr Jul Oct

Datacenter peak load

Idle time

Page 57: Patterns For Cloud Computing

How can Windows Azure help?

Page 58: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web RoleBrowserRequest

Worker Role Azure StorageResponse

“Wow! What a great site!”

Page 59: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Role Worker Role AzureStorage

Browser

“Server Busy”

Browser

Browser

Browser

Browser

Page 60: Patterns For Cloud Computing
Page 61: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Role Worker Role AzureStorage

Browser

Browser

Browser

Browser

Browser

Web Role

Web Role

N L B

You don’t see this bit

Page 62: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Role AzureStorage

Browser

Browser

Browser

Browser

Browser

Web Role

Web Role

N L B

Worker Role

Worker Role

Worker Role

N L B

Page 63: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Role AzureStorage

Browser

Browser

Browser

Browser

Browser

Web Role

Web Role

N L B

Worker Role

Worker Role

Worker Role

N L B

p1 p2 p3

Page 64: Patterns For Cloud Computing

OK, so changing config is easy...

…but what else do I need to know?

Page 65: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Role AzureStorage

Browser

Browser

Browser

Browser

Browser

Web Role

Web Role

N L B

WorkerRole

Worker Role

Worker Role

N L B

p1 p2 p3

Page 66: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Role Worker Role

Tight coupling between web and worker role is an anti-pattern

Page 67: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Role Worker Role

Queue

Req

1. Place on queue 3. Pickup from queue

4. Process

2. Respond to UI

Page 68: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Role Worker Role

Queue

Req

4. Process

Table

5. Add result to table

6. Query table on refresh

Page 69: Patterns For Cloud Computing

Demo: PrimeSolvr

Page 70: Patterns For Cloud Computing

How many web and worker roles do you need?

Page 71: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Role Worker Role AzureStorage

Browser

Browser

Browser

Browser

Browser

Web Role

Web Role

N L B

Collate IIS logs/ MOM packTesting

Page 72: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Role Worker Role

Queue

Req

Page 73: Patterns For Cloud Computing

#1 - Using the Cloud for Scale

Web Role

Queue

Req

Web Role

Web Role

Req Req

Monitor queuelength against user’s

expectationsWeb Role

Web Role

Web Role

Worker Role

Worker Role

Worker Role

Worker Role

Worker Role

Worker Role

Page 74: Patterns For Cloud Computing

Patterns for Cloud Computing

Takeaways

Understand how to communicate

between Web and Worker role

Strategy on when to scale up/down

roles in production

Using configuration, Azure makes it

easy to scale roles

Page 75: Patterns For Cloud Computing

Patterns for Moving to the Cloud

Using the Cloud for Multi Tenancy

Page 76: Patterns For Cloud Computing

“I like the idea of scaling Web roles…”

Patterns for Cloud Computing

Page 77: Patterns For Cloud Computing

“…but need to serve multiple customers”

Patterns for Cloud Computing

Page 78: Patterns For Cloud Computing

“Without creating separate codebases!”

Patterns for Cloud Computing

Page 79: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

Web TierBrowser B/L Tier DatabaseCustomer #1

Page 80: Patterns For Cloud Computing

How would Jim do this today on premises?

Page 81: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

Web TierBrowser B/L Tier DatabaseCustomer #2

Web TierBrowser B/L Tier DatabaseCustomer #1

Web TierBrowser B/L Tier DatabaseCustomer #3

How would Jim do this today on premises?

Page 82: Patterns For Cloud Computing

Gets expensive pretty quickly

Page 83: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

Web TierBrowser B/L Tier Database

Browser

Browser

Customer #1

Customer #2

Customer #3

Page 84: Patterns For Cloud Computing

Schema Customizations

UI Customizations

Page 85: Patterns For Cloud Computing

Schema Customizations

UI Customizations

Page 86: Patterns For Cloud Computing

3 options for data in multi tenant environment

Page 87: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

Web TierBrowser B/L Tier Database

Browser

Browser

Customer #1

Customer #2

Customer #3Option 1: Everyone Uses the Same Database/Schema

Fixed Schema

Pros: Simplest approach, easy to maintain/upgrade.Cons: No customizations. Restoring of tenant data.

Page 88: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

Web TierBrowser B/L Tier

DatabaseBrowser

Browser

Customer #1

Customer #2

Customer #3

Option 2: Give Each Customer Their Own Database/Schema

Customer #1

Database

Database

Customer #2

Customer #3

Pros: Flexible. Tenant restore is easier. High Isolation.Cons: Can be costly. Difficult to upgrade db schemas.

Page 89: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

Web TierBrowser B/L Tier Database

Browser

Browser

Customer #1

Customer #2

Customer #3Option 3: Fixed Database/Schema, with customizations

Fixed Schemawith Customizations

Pros: Customers can add their own custom fieldsCons: Non standard way of customizing the schema. Tenant restore is difficult.

Page 90: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

TenantID

Tenant

int

TenantName nvarchar

EmployeeId

Employee

int

FirstName nvarchar

LastName nvarchar

CustomizationID

Customization

int

Value nvarchar

TypeID

Type

int

Name nvarchar

CLRType nvarchar

1

*

*

1

*

1

*

*

Page 91: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

TenantID

Tenant

1

TenantName UK Branch

EmployeeId

Employee

1

FirstName Gordon

LastName Brown

CustomizationID

Customization

1

Value SW1A 2AA

TypeID

Type

1

Name PostalCode

CLRType string

1

*

*

1

*

1

*

*

Page 92: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

TenantID

Tenant

2

TenantName US Branch

EmployeeId

Employee

2

FirstName Barack

LastName Obama

CustomizationID

Customization

2

Value 20500

TypeID

Type

2

Name ZipCode

CLRType string

1

*

*

1

*

1

*

*

Page 93: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

TenantID

Tenant

2

TenantName US Branch

EmployeeId

Employee

2

FirstName Barack

LastName Obama

CustomizationID

Customization

2

Value 20500

TypeID

Type

2

Name ZipCode

CLRType string

1

*

*

1

*

1

*

*

Fixed SchemaApplies to All

Tenants

CustomizableTenant by Tenant

Basis

Could be both

Page 94: Patterns For Cloud Computing

Schema Customizations

UI Customizations

Page 95: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

Web TierBrowser B/L Tier Database

Browser

Browser

Customer #1

Customer #2

Customer #3

Page 96: Patterns For Cloud Computing

URL Handing

Page 97: Patterns For Cloud Computing

Can ASP.NET MVC Help?

Page 98: Patterns For Cloud Computing

Single Controller per Tenant

http://employeedata.cloudapp.net/CompanyA(CompanyAController)

http://employeedata.cloudapp.net/CompanyB(CompanyBController)

Page 99: Patterns For Cloud Computing

Shared Controller per Tenant

http://employeedata.cloudapp.net/CompanyA(EmployeeController)

http://employeedata.cloudapp.net/CompanyB(EmployeeController)

Page 100: Patterns For Cloud Computing

Shared Controller per Tenant (with URL mask)

http://hr.companya.co.uk(http://employeedata.cloudapp.net/employees)

http://hr.companyb.com(http://employeedata.cloudapp.net/employees)

Page 101: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

Web TierBrowser B/L Tier Database

Browser

Browser

Customer #1

Customer #2

Customer #3

http://hr.companya.co.uk

http://hr.companyb.com

http://employeedata.cloudapp.net

Page 102: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

Web TierBrowser B/L Tier Database

Browser

Browser

Customer #1

Customer #2

Customer #3

http://hr.companya.co.uk -> CNAME (employeedata.cloudapp.net)

http://hr.companyb.com -> CNAME (employeedata.cloudapp.net)

http://employeedata.cloudapp.net

Page 103: Patterns For Cloud Computing

#2 - Using the Cloud for Multi Tenancy

Web TierBrowser B/L Tier Database

Browser

Browser

Customer #1

Customer #2

Customer #3

http://hr.companya.co.uk -> CNAME (employeedata.cloudapp.net)

http://hr.companyb.com -> CNAME (employeedata.cloudapp.net)

Use custom routing in ASP.NET MVC

http://employeedata.cloudapp.net

Page 104: Patterns For Cloud Computing

Demo: Multi Tenant Routing using ASP.NET MVC

Page 105: Patterns For Cloud Computing

Patterns for Cloud Computing

Takeaways

Design considerations must include

both data and UI

Many other considerations

(such as identity)

Always consider Multi Tenancy first,

even if only one customer

Page 106: Patterns For Cloud Computing

Patterns for Moving to the Cloud

Using the Cloud for Compute

Page 107: Patterns For Cloud Computing

Jim has seen how Azure enables multiple nodes

Patterns for Cloud Computing

Page 108: Patterns For Cloud Computing

“Can I use all of these nodes in parallel?”

Patterns for Cloud Computing

Page 109: Patterns For Cloud Computing

“I’ve got this multi-GB file I need analyzing…”

Patterns for Cloud Computing

Page 110: Patterns For Cloud Computing

#3 - Using the Cloud for Compute

MasterClient

Data

Worker

Worker

Worker

Data

Data

Data

Page 111: Patterns For Cloud Computing

#3 - Using the Cloud for Compute

MasterClient

Result

Worker

Worker

Worker

Result

Result

Result

Page 112: Patterns For Cloud Computing

Popularized by the term “MapReduce”*

* 2004 OSDI paper by Jeff Dean and Sanjay Ghemawat (Google)

Page 113: Patterns For Cloud Computing

#3 - Using the Cloud for Compute

MasterClient

Data

Worker

Worker

Worker

“Map”

M<k,v>

M<k,v>

M<k.v>

M<“the quick brown”.”e”>M<“fox jumps over”.”e”>M<“the lazy dog”.”e”>

How many ”e”’s in“The quick brown fox jumps over the lazy dog”?

Page 114: Patterns For Cloud Computing

#3 - Using the Cloud for Compute

MasterClient

Result

Worker

Worker

Worker

“Reduce”

L<k,v>

L<k,v>

L<k,v>

L<”e”,”1”>L<”e”,”1”>L<”e”,”1”>

3 x ”e”s found

Page 115: Patterns For Cloud Computing

And it’s definitely popular...

Page 116: Patterns For Cloud Computing

#3 - Using the Cloud for Compute

Google20pb of data analyzed every day using MapReduce

Yahoo!10k+ cores, 4pb of data using MapReduce

Facebook2500+ cores, 1pb of data using MapReduce

Page 117: Patterns For Cloud Computing

Frameworks

Page 118: Patterns For Cloud Computing

#3 - Using the Cloud for Compute

Apache HadoopOpen Source Java “Inspired by MapReduce”

(Core, HDFS, many more)

ClouderaConsulting, training, distribution of Hadoop

Amazon Elastic MapReduceHadoop implementation on EC2

Page 119: Patterns For Cloud Computing

How would Jim do this today on premises?

Page 120: Patterns For Cloud Computing

#3 - Using the Cloud for Compute

MasterClient

Data

Worker

Worker

Worker

Data

Data

DataClient Application Job/Task Scheduler

Remote Service

How would Jim do this today on premises?

Page 121: Patterns For Cloud Computing

How about implementing this on Windows Azure?

Page 122: Patterns For Cloud Computing

#3 - Using the Cloud for Compute

Web RoleClient

Data

Worker

Worker

Worker

Data

Data

DataClient Application Job/Task Scheduler

Remote Service

Queue

Req

Table

Page 123: Patterns For Cloud Computing

Demo: Windows Azure Demo “Inspired by MapReduce”

Page 124: Patterns For Cloud Computing

Patterns for Cloud Computing

Takeaways

Learn about existing frameworks,

especially Apache Hadoop

Read up on Dryad (DryadLINQ) for

future direction

MapReduce very visible, although

can be difficult to initially grasp

Page 125: Patterns For Cloud Computing

Patterns for Moving to the Cloud

Using the Cloud for Storage

Page 126: Patterns For Cloud Computing

“The cloud lets me store infinite data, right?”

Patterns for Cloud Computing

Page 127: Patterns For Cloud Computing

Lots of headaches with data management today

Patterns for Cloud Computing

Page 128: Patterns For Cloud Computing

“It sounds too good to be true…”

Patterns for Cloud Computing

Page 129: Patterns For Cloud Computing

How does Jim do this today on premises?

Page 130: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

File ServerClientRPC/NFSFile

Store

How would Jim do this today on premises?

Page 131: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

DB ServerClient RDBMS

TDS (Tabular Data Stream)Data

How would Jim do this today on premises?

Page 132: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

Web ServerBrowser DatabaseHTTP POSTData

How would Jim do this today on premises?

Page 133: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

Server Data

Affinity between your data and physical hardware that serves it

I love you!

I love you too!

Page 134: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

Server Data

I love you!

I love you too!

Symptoms:Which RAID number was that again?

Tedious to backup exponentially growing dataCrap! I’m at 95% capacity - got to move to a bigger disk

Page 135: Patterns For Cloud Computing

How does the cloud help?

Page 136: Patterns For Cloud Computing

Breaks the affinity between your data and hardware

Page 137: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

Client Cloud Storage

“Code Near” PatternData access code near to home, long data connection

DAL

Good for offline scenarios + client applications

DAL -> Storage typically REST connection

Page 138: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

Client Cloud Storage

“Code Far” PatternData access code far from home, short data connection

DAL

Good for browser based scenarios, but no offline.Good for “chattier” applications between DAL and database

Web Tier

Page 139: Patterns For Cloud Computing

Blobs, Tables, Relational

Page 140: Patterns For Cloud Computing

Blobs, Tables, Relational

Page 141: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

Client Azure Blob Storage

REST API

PutBlobPUT http://account.blob.core.windows./net/containername/blobname

Blob Container

http://account.blob.core.windows.net/containername/blobname

PutBlob = 64Mb MAXMetaData = 8Kb per Blob

Page 142: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

Client Azure Blob Storage

REST API

GetBlobGET http://account.blob.core.windows./net/containername/blobname

Blob Container

http://account.blob.core.windows.net/containername/blobname

Page 143: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

Client Azure Blob Storage

REST API

GetBlobGET http://account.blob.core.windows./net/containername/blobnameRange: bytes=329300 - 730000

Blob Container

http://account.blob.core.windows.net/containername/blobname

Page 144: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

Client Azure Blob Storage

REST API

PutBlock(blobname, blockid, data)PutBlockList(blobname, blockid1, …, blockidN)

Blob Container

http://account.blob.core.windows.net/containername/blobname

PutBlock = 4Mb MAX to a maximum of 50GbBlockId = 64 bytes

Page 145: Patterns For Cloud Computing

Blobs, Tables, Relational

Page 146: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

Worker Role AzureTable Storage

Each Table:

PartitionKey (e.g. DocumentName) to ensure scalabilityRowKey (e.g. version number)[fields] for data

http://account.table.core.windows.net

REST: GET http://account.table.core.windows.net/Customer?$filter=%20PartitionKey%20eq%20valueLINQ:var customers = from o in context.CreateQuery<customer>(“Customer”) where o.PartitionKey== value select o;

Page 147: Patterns For Cloud Computing

Blobs, Tables, Relational

Page 148: Patterns For Cloud Computing

Codename Sitka (early 2008)

Page 149: Patterns For Cloud Computing

SQL Server Data Services (MIX08)

Page 150: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

DB ServerClient RDBMSTDSData

This is what I’m doing on premises...

Page 151: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

DB ServerClient RDBMSTDSData

So, this is what I would like to do in the cloud...

Page 152: Patterns For Cloud Computing

SQL Data Services (MIX09)

Page 153: Patterns For Cloud Computing

SQL Azure (July 2009)

Page 154: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

SQL AzureClient RDBMSTDSData

So, this is what I would like to do...

Page 155: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

SQL AzureBrowser RDBMSTDS

Web RoleHTTP

Page 156: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

SQL AzureBrowser RDBMS

TDSWeb Role

HTTPWorker Role

Queue

Page 157: Patterns For Cloud Computing

Migration!

Page 158: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

Browser RDBMSWeb TierHTTP

Bus. Logic

“The Data Center”

SQL ServerTDS

Page 159: Patterns For Cloud Computing

#4 - Using the Cloud for Storage

SQL AzureBrowser RDBMS

TDSWeb Role

HTTPWorker Role

Queue

“The Cloud”

Page 160: Patterns For Cloud Computing

Demo: SQL Azure CTP

Page 161: Patterns For Cloud Computing

Patterns for Cloud Computing

Takeaways

Read up and understand code

near/code far models

SQL Azure as a factor for

migration/move from on premises

Understand the pricing model for

storage on-premises vs. cloud

Page 162: Patterns For Cloud Computing

Patterns for Moving to the Cloud

Using the Cloud for Communications

Page 163: Patterns For Cloud Computing

Jim’s organization needs to communicate with

other organizations

Patterns for Cloud Computing

Page 164: Patterns For Cloud Computing

“This has always been a very tricky and expensive

process to get working”

Patterns for Cloud Computing

Page 165: Patterns For Cloud Computing

“Does the cloud offer anything to help?”

Patterns for Cloud Computing

Page 166: Patterns For Cloud Computing

How would Jim have done this before?

Page 167: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

Client Server

Company 1 Company 2Telco provided WAN

FTPClient

FTPServer

Page 168: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

Client Server

Company 1 Company 2Telco provided WAN

FTPClient

FTPServer

Internet

Page 169: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

Client Server

Company 1 Company 2Telco provided WAN

Browser

Internet

ExtranetSite

DMZ

Page 170: Patterns For Cloud Computing

What does the cloud provide?

Page 171: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

ClientREST

Azure Queue

http://app.queue.core.windows.net/

Page 172: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

Client

REST

Azure Queue

http://app.queue.core.windows.net/

Client

Company 1

Company 2

Page 173: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

Client

REST

Azure Queue

http://app.queue.core.windows.net/

Client

Company 1

Company 2

Page 174: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

Client

REST

Azure Queue

http://app.queue.core.windows.net/

Client

Company 1

Company 2

Master Key

Master Key

Page 175: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

Client

REST

Azure Queue

http://app.queue.core.windows.net/

Client

Company 1

Company 2

Web Role

Page 176: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

Client

REST

Azure Queue

http://app.queue.core.windows.net/

Client

Company 1

Company 2

Web Role

Firewall

Firewall

Proxy?

Page 177: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

Client

REST

Azure Queue

http://app.queue.core.windows.net/

Client

Company 1

Company 2

Web Role

Firewall

Firewall

NAT?

65.55.33.204

192.168.14.100

Page 178: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

Client

REST

Azure Queue

http://app.queue.core.windows.net/

Client

Company 1

Company 2

Web Role

Firewall

Firewall

65.55.33.204

192.168.14.100

OK, so I’ll do a HTTP poll every minute

Page 179: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

Client

REST

Azure Queue

http://app.queue.core.windows.net/

Client

Company 1

Company 2

Web Role

Firewall

Firewall

65.55.33.204

192.168.14.100

…and how about other protocols other than HTTP?

Page 180: Patterns For Cloud Computing

How does the .NET Service Bus help?

Page 181: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

Client

Outbound bi-directional socketKept alive in background

.NET Service Bus

sb://.../myqueue

Client

Company 1

Company 2

Firewall

Page 182: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

Client

Outbound bi-directional socketKept alive in background

.NET Service Bus

sb://.../myqueue

Client

Company 1

Company 2

Firewall

FirewallOutbound one-way socket

Message routedaccordingly

Page 183: Patterns For Cloud Computing

#5 - Using the Cloud for Communications

My Laptop

Outbound bi-directional socketKept alive in background

.NET Service Bus

sb://.../myqueue

Home PC

This Conference

My Home

Firewall

FirewallOutbound one-way socket

Message routedaccordingly

192.168.14.193

My SQL

Port 3306

Localhost:1000

MySQL Admin

Page 184: Patterns For Cloud Computing

Demo: Socket Shifter

Page 185: Patterns For Cloud Computing

Patterns for Cloud Computing

Takeaways

Firewalls/NATs can add additional

trouble (especially non-HTTP)

Learn how .NET Service Bus

traverses in these scenarios

Be careful consuming Azure queues

directly via REST

Page 186: Patterns For Cloud Computing

Next Steps

Page 187: Patterns For Cloud Computing

Obviously, our friend Jim, is fake…

Next Steps

Page 188: Patterns For Cloud Computing

Next Steps

Make sure you have a clear definition

of Cloud Computing

Explore the 5 usage patterns for

your scenarios today

Think about the next steps for

implementation and migration

Page 189: Patterns For Cloud Computing

[email protected]

http://simonguest.com