40
W15 - Architecture Best W15 - Architecture Best Practices on Windows Azure Practices on Windows Azure Nuno Godinho Nuno Godinho Cloud Solution Architect Level: Intermediate

Architecture Best Practices on Windows Azure

Embed Size (px)

DESCRIPTION

Presentation for Visual Studio Live @ Las Vegas 2012

Citation preview

W15 - Architecture Best W15 - Architecture Best Practices on Windows AzurePractices on Windows Azure

Nuno GodinhoNuno GodinhoCloud Solution Architect

Level: Intermediate

About MeAbout Me

Nuno Filipe Godinho

Cloud Solution Architect @ Aditi

Windows Azure MVP

[email protected]

http://msmvps.com/blogs/nunogodinho

Twitter: @NunoGodinho

AgendaAgenda

• Changing Metrics• Architecture Best Practices• Key Takeaways

CHANGING METRICSCHANGING METRICSTraditional architecture vs. Cloud architecture

CapExCapEx

TIME

IT CAPACITY

Actual Load

Allocated IT-

capacities

Overcapacity

Undercapacity

Fixed cost of IT-capacities

Load Forecast

Investment

OpExOpEx

Actual Load

Allocated IT

capacities

Reduction of initial

investments

Reduction of

overcapacity

No undercapacity

Possible reduction of IT-capacities

in case of reduced

load

IT CAPACITY

Load Forecast

TIME

THE Challenge!THE Challenge!

• Traditional architecture– Overcapacity available

– Extra layers != extra costs

– Costs are hidden

• Cloud architecture– No overcapacity

– Extra layers == extra costs

– Costs are visible

In the Cloud YOU pay for ...In the Cloud YOU pay for ...

Windows Azure SQL Azure Block Services

the services used

+ the data transfer consumed

DataCenterOutside the datacenter

1. 1. ComputeCompute

2. 2. StorageStorage

3. Storage3. StorageTransactioTransactio

nsns

5. Access 5. Access Control Control

TransactionTransactionss

6. Service 6. Service Bus Bus

ConnectionsConnections

7. out7. out

4. DB4. DB

Too Many parameters???Too Many parameters???

• Typically you only use 4-5:– Compute hours

– Storage

– Storage Transactions

– SQL Azure database

– Service Bus Connections

– Access Control Service

– Caching

Complex?Complex?Let’s see! Here are some of your datacenter parameters ...

Complex?Complex?Let’s see! Here are some of your datacenter parameters ...

What about Now?

Still think the same?

What about Now?

Still think the same?

ARCHITECTURE BEST ARCHITECTURE BEST PRACTICESPRACTICES

Architect for ScaleArchitect for Scale

• Prepare to Scale Up & Scale Out• Approaches:

– Have more processing power or storage in your app

Scale out to multiple instances, based on performance metrics

Partition your data Table Storage : partition keys

SQL Azure : shardingAsynchronous architectures

– Distribute load to other places

Content Delivery NetworkFederated Authentication and Authorization AppFabric Caching

Architect for Scale – Scale OutArchitect for Scale – Scale Out

Webrole

Instance 1Instance 1

Instance 2Instance 2

Instance 3Instance 3

NLB

Webrole

Instance 1Instance 1

Instance 2Instance 2

Instance 3Instance 3

Architect for Scale – Scale OutArchitect for Scale – Scale Out

NLB

Webrole

Instance 1Instance 1

Instance 2Instance 2

Instance 3Instance 3

“round robin”no sticky sessions !

Architect for Scale – Scale OutArchitect for Scale – Scale Out

NLB

Architect for Scale – Scale OutArchitect for Scale – Scale Out

AppAppAppApp

running on 2 instances

performance metrics

Local DB

Local DB

Scaling engineScaling engine

defines on metrics and polling intervals interpret metrics

Configuration

changes the configuration

AppApp

3

Prepare for Dynamic ScalingPrepare for Dynamic Scaling

• Monitor key performance indicators.

• Dynamically increase or decrease the number of worker role instances.

• Programmatically expand and trim down the number of processing threads to adapt to variable load conditions.

Prepare for Dynamic ScalingPrepare for Dynamic Scaling

• Partition and process fine-grained workloads concurrently using the Task Parallel Library in the .NET Framework 4.

• Maintain a viable capacity in solutions with highly volatile workload in anticipation of sudden spikes to be able to handle them without the overhead of setting up additional instances.

Plan for Disaster RecoveryPlan for Disaster Recovery

• Disasters happen, plan for it

• Analyze the impacts of an outage for your solution/business

Secure your CommunicationsSecure your Communications

• Service Bus Relay with ACS to improve service security

• Use SSL whenever possible

• Don’t share your secrets– Storage Account

– Service Bus

– Access Control Service

– Caching

– ...

Pick the right Compute SizePick the right Compute Size

• Remember: 1 role instance == 1 VM running Windows. 1 role instance != one specific task for your

code You’re paying for the entire VM so why not

use it?

Partition your DataPartition your Data

• Partition Data based on the indexing needs. – SQL Azure for highly indexed data

– Storage for the rest.

– Hybrid Partitioning is normally the best approach

• Shard your SQL Azure data across databases to increase the workload.

Horizontal PartitioningHorizontal Partitioning

Vertical PartitioningVertical Partitioning

Hybrid PartitioningHybrid Partitioning

Instrument your SolutionInstrument your Solution

Note: Remember to account for monitoring and diagnostic usage costs!

Cost Savings

Federate your IdentityFederate your Identity

• Instead of having another Identity Silo, Federate your Identity

• Make your solutions available with Claim-based Identity to increase the security

• Consider having Federation with multiple IdP

Use Asynchronous and reduce Use Asynchronous and reduce coupling coupling

• Make your architecture work asynchronously

• Embrace Compensable Transactions

• Use Queues to orchestrate work loads

Asynchronous Work LoadsAsynchronous Work Loads

Servicewebrole

Instance 1Instance 1

Instance 2Instance 2

Instance 3Instance 3

workerrole

Instance 1Instance 1

Instance 2Instance 2

Instance 3Instance 3

busy

free

busy

Putmessage

Asynchronous Work LoadsAsynchronous Work Loads

web role

Instance 1Instance 1

Instance 2Instance 2

Instance 3Instance 3

worker role

Instance 1Instance 1

Instance 2Instance 2

Instance 3Instance 3

busy

free

busy

Getmessage

one (and only one) free Instance of the worker role gets the message

Service

Architect Workers for IdempotencyArchitect Workers for Idempotency

• Workers need to perform the operation only once even if called several times

• Built failure recovery mechanisms

Batch Your WorkBatch Your Work

• Batch multiple small work items into a single queue message

• Take several messages at a time

Reduce CouplingReduce Coupling

Reduce ClouplingReduce Cloupling

Reduce LatencyReduce Latency

• Use Affinity Groups to lower the latency between your service elements– Compute

– Storage

• Make services closer and in the same Data Center and close to each other (in the same Cluster)

Make your Internal Communidation Make your Internal Communidation SecureSecure

• Use Internal Endpoints to gain communication between services deployed in Windows Azure and increase security

• Always define Traffic Rules for your Internal Entpoints

KEY TAKEAWAYSKEY TAKEAWAYS

Key TakeawaysKey Takeaways

1. Architect for Scale

2. Plan for Disaster Recovery

3. Secure your Communications

4. Pick the right Compute size

5. Partition your Data

6. Instrument your Solution

7. Federate your Identity

8. Use Asynchronous and Reduce Coupling

9. Reduce Latency

10. Make Internal Communication Secure

Thank YouThank YouNuno GodinhoNuno Godinho

Cloud Solution Architect @ Aditi

[email protected]: @NunoGodinho

http://msmvps.com/blogs/nunogodinho