10 things ever architect should know about the windows azure platform - ericnel

61
Page 1 Eric Nelson | ISV Application Architect | Microsoft UK [email protected] | http://bit.ly/ericnelson | http://twitter.com/ericnel 10 things every architect needs to know

Upload: eric-nelson

Post on 22-May-2015

7.324 views

Category:

Technology


5 download

DESCRIPTION

Deck used at Software Architect 2010, Oct 2010.

TRANSCRIPT

Page 1: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 1

Eric Nelson | ISV Application Architect | Microsoft UK

[email protected] | http://bit.ly/ericnelson | http://twitter.com/ericnel

10 things every architect needs to know

Page 2: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 2

Assumption

• You already have some

familiarity with the Windows

Azure Platform

• If you don’t then you will still

learn stuff

– But you will be missing some

context. Sorry

– Also check out • http://bit.ly/azuretrenchesbookvol1

• http://ukazure.ning.com/events

Page 3: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 3

Agenda Overview

• Dynamic environment

• Role Instances

• Latency & timeouts

• Transactions & bandwidth

• Data/state

• Data sensitivity

Summary

Page 4: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 4

Overview

Page 5: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 5

Windows Azure Platform

makes it easy and cost effective

to run your applications

and store your data

inside Microsoft Data Centres

using existing skills

and integrate with

your existing on-premise applications

Page 6: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 6

Windows Azure Platform

Page 7: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 7

Your code runs in Hosted Services made up of Roles

Page 8: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 8

Your Roles are code + configuration

Page 9: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 9

You choose which type(s) of Role to run your code in

Page 10: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 10

Load

Balancer

At runtime you can have multiple instances of your Roles

http://yourapp.cloudapp.net

Page 11: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 11

You store your data in Windows Azure Storage

Page 12: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 12

And/or you store your data in SQL Azure

Page 13: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 13

It’s not really

different.

There is just

more of it

It’s not really

different.

There is just

less of it

Therefore many Windows Web development

best practices apply

Vs traditional Windows development

Page 14: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 14

Your Data

Your Code

“Typical” Azure Application

L

B

Web Site (ASPX, ASMX, WCF) Web Site

(ASPX, ASMX, WCF) Web Role

(ASPX, WCF, PhP)

Worker

Service Worker

Role

L

B

Queues

Blobs

Tables Internet

Windows Azure Platform

Your Relational Data

Tables Views SPs Triggers

Page 15: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 15

Usage

Co

mp

ute

Time

Average

Inactivity

Period

“On and Off “

On and off workloads (e.g. batch job)

Over provisioned capacity is wasted

Time to market can be cumbersome

Co

mp

ute

Time

“Unpredictable Bursting“

Average

Usage

Unexpected/unplanned peak in demand

Sudden spike impacts performance

Can’t over provision for extreme cases

Average

Usage

Co

mp

ute

Time

“Growing Fast“

Successful services needs to grow/scale

Keeping up w/growth is big IT challenge

Complex lead time for deployment

Co

mp

ute

Time

Average

Usage

“Predictable Bursting“

Services with micro seasonality trends

Peaks due to periodic increased demand

IT complexity and wasted capacity

Is it just about this?

Page 16: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 16

“I want to try something now“

Need to quickly provision new machines for a temporary period of time

“Departmental“

Need to quickly provision new machines for a departmental solution

Or is it also about this?

Mach

ines

Time

Mach

ines

Time

“Just store

data in the Cloud“

With all processing elsewhere

“Extend to

the Cloud“

Extend existing applications

“Migrate existing

applications“

Benefits of reduced operational costs

“New hybrid services“

On-premise and Cloud aka S+S

Page 17: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 17

Behavioral changes

Developers

feel

empowered

Cost of

architectural

decisions is

more visible

Developers

become

entrepreneurs

Page 18: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 18

Agenda Overview

• Role Instances

• Dynamic environment

• Latency & timeouts

• Transactions & bandwidth

• Data/state

• Data sensitivity

Summary

Page 19: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 19

Dynamic Environment

Page 20: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 20

Control over network topology

and machines Limited control over IPs, ports

Consistent bandwidth with

stable latency

Control over machine

identification

Machine names can change

every time an instance starts

Limited control over lifetime,

state becomes transient Control over machine lifetime

Variable latency and bandwidth

Traditional Windows

Azure

Dynamic Environment means…

Admin

Control

Latency

Volatility

Identification

Page 21: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 21

Admin control (or lack of it)

• Limited access to local environment and state

– No admin rights and privileges are available (yet).

– No pre-setup or configuration can be done (yet).

• Code defines exact set up of roles which

provides uniformity across instances

Page 22: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 22

Volatility: Your instances will be stopped

React

• When an instance goes away, it’s

gone, including its state!

• Properly handle state so it can

be preserved.

Patching

Moving

Failure

Notification of

instance

lifecycle events

Page 23: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 23

Role instance management example

Page 24: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 24

Dynamic networking

• Dynamic environment means dynamic networking – Ports changes

– IPs change

– Cannot rely on node IPs or machine names

• The traditional way of networking may no longer be the best fit. – Direct communication is possible

– Shift to indirect • Using Windows Azure storage

• Using Windows Azure Service Bus

Page 25: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 25

Role Instances

Page 26: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 26

Instances of Role Types

Finance

Message

“Typical Application”

Queue

10

Sec

Worker

Role A

Web

Role A

Queue

Finance

Message

10

Sec

Worker

Role A

Web

Role A

Worker

Role A

Web

Role A

But…

TIP: Queue writes are approx 20/s per writer

Page 27: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 27

Consolidation of Role Types

HR

Queue

Finance

Queue

Sales

Queue

HR

Message Finance

Message

Sales

Message

10

Sec

10

Sec

5

Sec

Scalable Message Passing

Worker

Role Worker

Role

Worker

Role

HR

Message

Finance

Message Sales

Message

Meta-queue

HR

Finance

Sales

Finance

10

Sec

Message Type?

Meta-worker Role

Meta-Message Passing

TIP: Web Roles can communicate direct to Workers

TIP: Maximum time to process a Q Item is 2 hours

Page 28: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 28

Elasticity and Roles

Queue

Finance

Message

10

Sec

Worker

Role A

Web

Role A

Worker

Role A

Web

Role A

From this

Queue

Finance

Message

10

Sec

Worker

Role A

Web

Role A

Worker

Role A

Web

Role A

To this

Web

Role A

10 to 15

minutes

Page 29: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 29

Latency and Timeouts

Page 30: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 30

Latency

Service

Request

App

Data

App

Consistent and accepted latencies

On premises application

Service

Request

App

Data App

Increases in quantity and

variability of latencies

Cloud based application

TIP: Expect Web Role to SQL Azure to take about twice as long

Page 31: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 31

Timeout

Service

Request App

Data

Timeouts?

App

Increased likelihood

of timeouts

Cloud based application

Service

Request App

Data App

Consistent, reliable

connectivity and access

On premises application

Yes

No

Yes

No Tried 5 times?

Connection Successful?

Try to connect

Continue doing

work

Fail

Page 32: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 32

Timeout Retry Code Example

Page 33: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 33

Timeout Retry Code Example

Page 34: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 34

Timeout Retry Code Example

TIP: There is a new code library for all this!

Page 35: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 35

Transactions & bandwidth

Page 36: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 36

Transactions & bandwidth

Access Control Per AC transactions/month

Service Bus Per connection/month

Bandwidth Per GB transfer to/from datacenter

Storage Per GB stored & transactions

•Bandwidth • Charged for usage

• Functionality that was not bandwidth

based may now be effected.

• E.g. using Windows Azure Blobs

instead of writing to disk

•Transactions • Charged by quantity

• Access types that were not

traditionally on a transaction count

may now be effected.

• E.g. using Access Control Services

and Storage

SQL Azure Per GB allocated database

by day

Page 37: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 37

Web Role

Blob Image Download Browser Bandwidth

Egress

Transaction

Web Role

Blob Image Download Browser Bandwidth

Egress

Transaction

Data center usage costing comparison

TIP: Increasing the size of the VM will increase network throughput

Page 38: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 38

Header

or

Overhead

Content

Message

Structure

Content

Content

Content

Batch Payloads

Frequent message

passing with a small

amount of data can

effect performance and

cost.

Content

Header Header

Header Header

Content

Head

er

Option 1:

Serialized

Message

Passing

Total Bytes

Co

nte

nt

# o

f tr

an

sact

ion

s

Header

Content

Content

Content

Option 2;

Packaged

Message

Passing

Head

er

Co

nte

nt

Content Total Bytes

# o

f tx

s

TIP: Use storage APIs to group transactions

TIP: Watch out for data formats!

TIP: Q items 8KB limit

Page 39: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 39

Single Query Use

Batch Queries

Query

Query

Query

Query

Query

Worker

Role A

Worker

Role B

Worker

Role C

Worker

Role D

Worker

Role E

Batch Query Use

Reduction of bandwidth

and transactions!

Query

Query

Query

Query

Query

Query

Query

Query

Query

Query

Worker

Role

Worker

Role

Page 40: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 40

Be aware of “new costs” e.g. polling

• Consider introducing polling a queue every 100ms

• 25,920,000 polls/month

• £0.0061 per 10,000 storage transactions

• Therefore it will cost – £15.81/month

• To get an SLA, need two worker roles polling – £31.62/month

• Cost of two workers – £0.0728 per hour x 720 x 2

– £104.83/month

• Total cost £136.45/month

Page 41: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 41

Instances polling storage

0

140 million

120 million

100 million

80 million

60 million

40 million

20 million

1 instance

100 ms

5 instances

100 ms

$140

$120

$100

$80

$60

$40

$20

Co

st p

er

Mo

nth

Be aware of cost

Tran

sact

ion

s p

er

Mo

nth

Page 42: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 42

Instances polling storage

0

140 million

120 million

100 million

80 million

60 million

40 million

20 million

5 instances

100 ms

5 instances

1 second

$140

$120

$100

$80

$60

$40

$20

Co

st p

er

Mo

nth

Be aware of cost

Tran

sact

ion

s p

er

Mo

nth

Page 43: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 43

Be wary of frequent transactions with little work being done

Instances polling storage

0

140 million

120 million

100 million

80 million

60 million

40 million

20 million

Tran

sact

ion

s p

er

Mo

nth

$140

$120

$100

$80

$60

$40

$20

Polls which

found work U

nn

ecess

ary

Co

st

Be aware of cost

Co

st p

er

Mo

nth

5 instances

100 ms

Page 44: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 44

• Poll less often

• Synchronize polling with

business needs

Polling best practices

12am til 4am

– every 1

minute

4am til 8am – every

10 seconds

8am to

12pm –

every 100ms

Page 45: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 45

HR

Message

Finance

Message Sales

Message

Polling best practices cont.

HR

Queue

Finance

Queue

Sales

Queue

HR

Message Finance

Message

Sales

Message

10

Sec

10

Sec

5

Sec

Meta-queue

HR

Finance

Sales

Finance

10

Sec

Message Type?

Meta-worker Role

Scalable Message Passing Meta-Message Passing

Worker

Role Worker

Role

Worker

Role

Page 46: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 46

Data/State

Page 47: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 47

Data/State

• Windows Azure instances are highly dynamic

– Role instance local data is volatile

• Instances are independent

– State changes are not reflected in other instances

• Therefore

– Local instance storage is only useful for temporary

data or as a cache

– All other data needs to be moved to durable storage

Page 48: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 48

You have many choices for data

Relational Database

Structured Storage

Unstructured Storage

NTFS Drive

Service Communication

Page 49: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 49

Side by Side Evaluation

Single Blob Drive Queue Table

Single SQL

Azure

Database

Structured Data Y Y

Relational Database Y

Server Side Processing Y

Direct Access from outside

Azure Y Y Y Y

Messaging Infrastructure Y

Persistent Storage Y Y 1 week Y Y

Size Limit 200 GB/ 1

TB 1 TB 100 TB 100 TB 50 GB (*)

Page 50: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 50

Example: Registry/Configuration/User Settings

A traditional set of data that is traditionally stored on the local

environment is configuration and user settings. Commonly this is stored

in the registry, xml or ini files.

Options Best Case Usage

Blob storage Configuration file that is read

only once during app load

SQL database Used in environments where a

SQL database already exists

Windows Azure table User settings that may be

changed externally from the

environment

Page 51: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 51

Tables for storing Data

Why do this?

Partition

Key

Row Key Data Data Data Data

Customer ID Description Name Credit Card # Order Total Tracking ID

1 Customer John Smith xxxx-xxxx-xxxx-xxxx

1 Order – 1 £35.12 Z783lhs

1 Order – 2 £75.00 Z829bhb

2 Customer Bill Johnson xxxx-xxxx-xxxx-xxxx

2 Order – 3 £10.00 Z778asd

2 Order – 4 £42.00 Z239uhy

3 Customer Travis Jones xxxx-xxxx-xxxx-xxxx

3 Order – 5 £25.93 Z329nps

3 Order – 6 £80.94 Z440ydd

Part

itio

n A

Part

itio

n C

Part

itio

n B

Page 52: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 52

Consider searching an address book

Search By Partition Key Row Key

Name Last name + First initial First name + Middle initial

Phone number Area code Number

Address County + city House number + Street

name

Selecting keys is … key

TIP: Replicate data to avoid joins and increase indexes

TIP: Table deletes take time

Page 53: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 53

Data Sensitivity

Page 54: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 54

Purchasing

Database Product

catalogue

Secure Transaction

(Service Bus)

Segmentation

Online Shop Online Shop

Product

catalogue

Page 55: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 55

Customer Credit Card #

Shipping Information

Last Name

First Name

Contact ID

Social Security #

Billing Data

Other Information

On Premises

Contact ID

Social Security #

Customer Credit Card #

Other Information

Shipping Information

Last Name

First Name

Contact ID

On Premises

Cloud

Sharding

Page 56: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 56

Customer Credit Card #

Shipping Information

Last Name

First Name

Contact ID

Social Security #

Billing Data

Other Information

On Premises

£!”$&$%!&£%

£”$&!%*^(&

!£$&!%£&%*

^$”$&%$”&

Shipping Information

Last Name

First Name

Contact ID

On Premises

Cloud

Encryption

Page 57: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 57

Agenda Overview

• Role Instances

• Dynamic environment

• Latency & timeouts

• Transactions & bandwidth

• Data/state

• Data sensitivity

Summary

Page 58: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 58

Summary

• Windows Web Development best practices apply

• But

• Cost becomes surprisingly significant in shaping

architectures

• Plenty of early adopters, therefore

– Good Architecture guidance is now appearing

– Plenty of detail to dig into

Page 59: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 59

NEXT STEPS

For latest slides and all the links http://bit.ly/ericnelson

For more resources and information http://bit.ly/startazure

As an ISV intending to explore/adopt azure, sign up to http://bit.ly/ukmpr

and come along and meet with us http://blogs.msdn.com/b/ukisvdev

Eric Nelson | ISV Application Architect | Microsoft UK [email protected] | http://bit.ly/ericnelson | http://twitter.com/ericnel

Page 60: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 60

SQL Azure Labs

Page 61: 10 things ever architect should know about the Windows Azure Platform -  ericnel

Page 61

Demo