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

Architecture Best Practices on Windows Azure

Oct 30, 2014

Download

Technology

Nuno Godinho

Presentation for Visual Studio Live @ Las Vegas 2012
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Architecture Best Practices on Windows Azure

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

Nuno GodinhoNuno GodinhoCloud Solution Architect

Level: Intermediate

Page 2: Architecture Best Practices on Windows Azure

About MeAbout Me

Nuno Filipe Godinho

Cloud Solution Architect @ Aditi

Windows Azure MVP

[email protected]

http://msmvps.com/blogs/nunogodinho

Twitter: @NunoGodinho

Page 3: Architecture Best Practices on Windows Azure

AgendaAgenda

• Changing Metrics• Architecture Best Practices• Key Takeaways

Page 4: Architecture Best Practices on Windows Azure

CHANGING METRICSCHANGING METRICSTraditional architecture vs. Cloud architecture

Page 5: Architecture Best Practices on Windows Azure

CapExCapEx

TIME

IT CAPACITY

Actual Load

Allocated IT-

capacities

Overcapacity

Undercapacity

Fixed cost of IT-capacities

Load Forecast

Investment

Page 6: Architecture Best Practices on Windows Azure

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

Page 7: Architecture Best Practices on Windows Azure

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

Page 8: Architecture Best Practices on Windows Azure

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

Page 9: Architecture Best Practices on Windows Azure

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

Page 10: Architecture Best Practices on Windows Azure

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

Page 11: Architecture Best Practices on Windows Azure

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?

Page 12: Architecture Best Practices on Windows Azure

ARCHITECTURE BEST ARCHITECTURE BEST PRACTICESPRACTICES

Page 13: Architecture Best Practices on Windows Azure

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

Page 14: Architecture Best Practices on Windows Azure

Architect for Scale – Scale OutArchitect for Scale – Scale Out

Webrole

Instance 1Instance 1

Instance 2Instance 2

Instance 3Instance 3

NLB

Page 15: Architecture Best Practices on Windows Azure

Webrole

Instance 1Instance 1

Instance 2Instance 2

Instance 3Instance 3

Architect for Scale – Scale OutArchitect for Scale – Scale Out

NLB

Page 16: Architecture Best Practices on Windows Azure

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

Page 17: Architecture Best Practices on Windows Azure

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

Page 18: Architecture Best Practices on Windows Azure

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.

Page 19: Architecture Best Practices on Windows Azure

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.

Page 20: Architecture Best Practices on Windows Azure

Plan for Disaster RecoveryPlan for Disaster Recovery

• Disasters happen, plan for it

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

Page 21: Architecture Best Practices on Windows Azure

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

– ...

Page 22: Architecture Best Practices on Windows Azure

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?

Page 23: Architecture Best Practices on Windows Azure

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.

Page 24: Architecture Best Practices on Windows Azure

Horizontal PartitioningHorizontal Partitioning

Page 25: Architecture Best Practices on Windows Azure

Vertical PartitioningVertical Partitioning

Page 26: Architecture Best Practices on Windows Azure

Hybrid PartitioningHybrid Partitioning

Page 27: Architecture Best Practices on Windows Azure

Instrument your SolutionInstrument your Solution

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

Cost Savings

Page 28: Architecture Best Practices on Windows Azure

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

Page 29: Architecture Best Practices on Windows Azure

Use Asynchronous and reduce Use Asynchronous and reduce coupling coupling

• Make your architecture work asynchronously

• Embrace Compensable Transactions

• Use Queues to orchestrate work loads

Page 30: Architecture Best Practices on Windows Azure

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

Page 31: Architecture Best Practices on Windows Azure

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

Page 32: Architecture Best Practices on Windows Azure

Architect Workers for IdempotencyArchitect Workers for Idempotency

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

• Built failure recovery mechanisms

Page 33: Architecture Best Practices on Windows Azure

Batch Your WorkBatch Your Work

• Batch multiple small work items into a single queue message

• Take several messages at a time

Page 34: Architecture Best Practices on Windows Azure

Reduce CouplingReduce Coupling

Page 35: Architecture Best Practices on Windows Azure

Reduce ClouplingReduce Cloupling

Page 36: Architecture Best Practices on Windows Azure

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)

Page 37: Architecture Best Practices on Windows Azure

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

Page 38: Architecture Best Practices on Windows Azure

KEY TAKEAWAYSKEY TAKEAWAYS

Page 39: Architecture Best Practices on Windows Azure

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

Page 40: Architecture Best Practices on Windows Azure

Thank YouThank YouNuno GodinhoNuno Godinho

Cloud Solution Architect @ Aditi

[email protected]: @NunoGodinho

http://msmvps.com/blogs/nunogodinho