55
Cloud-Native Azure Vermont Code Camp 2 11-September-2010 Copyright (c) 2010, Bill Wilder Boston Azure User Group http://bostonazure.org @bostonazure Bill Wilder http://blog.codingoutlou d.com @codingoutloud Boston West Toastmasters http://bwtoastmasters. com Not here with my day job Only Bill’s personal views Building Cloud-Native applications using Windows Azure

Building Cloud-Native Applications with Microsoft Windows Azure

Embed Size (px)

DESCRIPTION

Cloud computing is here to stay, and it is never too soon to begin understanding the impact it will have on application architecture. In this talk we will discuss the two most significant architectural mind-shifts, discussing the key patterns changes generally and seeing how these new cloud patterns map naturally into specific programming practices in Windows Azure. Specifically this relates to (a) Azure Roles and Queues and how to combine them using cloud-friendly design patterns, and (b) the combination of relational data and non-relational data, how to decide among them, and how to combine them. The goal is for mere mortals to build highly reliable applications that scale economically. The concepts discussed in this talk are relevant for developers and architects building systems for the cloud today, or who want to be prepared to move to the cloud in the future. This talk was delivered by Bill Wilder at the Vermont Code Camp 2 on 11-Sept-2010.

Citation preview

Page 1: Building Cloud-Native Applications with Microsoft Windows Azure

Cloud-Native Azure

Vermont Code Camp 211-September-2010

Copyright (c) 2010, Bill Wilder

Boston Azure User Grouphttp://bostonazure.org@bostonazure

Bill Wilderhttp://blog.codingoutloud.com@codingoutloud

Boston West Toastmasters http://bwtoastmasters.com

Not here with my day jobOnly Bill’s personal views

Building Cloud-Native applications using Windows Azure

Page 2: Building Cloud-Native Applications with Microsoft Windows Azure

Agenda

?

Page 3: Building Cloud-Native Applications with Microsoft Windows Azure

What is “the cloud”?

?

Page 4: Building Cloud-Native Applications with Microsoft Windows Azure

The Cloud Opportunity

1. Replace “your” infrastructure with “their” infrastructure

2. Save money, shift risk, shorten time-to-market

Page 5: Building Cloud-Native Applications with Microsoft Windows Azure

The Cloud Provides…

1. Efficient Scalability2. Elasticity on Demand3. Complexity Reduction

through Abstraction4. A few new challenges

Page 6: Building Cloud-Native Applications with Microsoft Windows Azure

Containers!http://www.microsoft.com/showcase/en/us/details/36db4da6-8777-431e-aefb-316ccbb63e4e

Page 7: Building Cloud-Native Applications with Microsoft Windows Azure

Global investment in Data Centers• Vendors build out – so you don’t have to• (increasingly…) “Containers” packed with• Fast, multi-core processors• Cheap, commodity hardware (memory, disk)

– Google’s famously bare-bones hardware

• Locations selected for efficiency considering– Cheap cooling, Cheap electricity– Geographical coverage

• Competitive bidding optimizes for Containers– Delivery “ready to plug-in” & “ready to unplug”

Page 8: Building Cloud-Native Applications with Microsoft Windows Azure
Page 9: Building Cloud-Native Applications with Microsoft Windows Azure

Most $$$ part of Software System?

Page 10: Building Cloud-Native Applications with Microsoft Windows Azure

Massive Automation, Efficiency

• Cross-Data Center Monitoring• Software and Hardware Virtualization

• Automated Deployment (across Data Centers)• HUGE win for customers lowering real costs

– Operational efficiency – you them– 100:1 10,000:1

Page 11: Building Cloud-Native Applications with Microsoft Windows Azure

Application Ownership

Slide stolen from Chris Bowen’s talk: Windows Azure: What? Why? And a Peek Under the Hood 13

Application Development

Network Addressing

Network Load Balancing

Hardware Repair

OS updates & Patches

OS Installation

Computational Scalability

Storage Scalability

Hardware Provisioning

Staging / Production

High Availability

Fault Tolerance

Data Center Management

Stuff We MightRather Not Deal With

Stuff We Like

Page 13: Building Cloud-Native Applications with Microsoft Windows Azure

Business Model Innovation

• DIFFERENTIATOR is business model that permits bursting system capacity up and down on demand without penalty– Just like electricity (without the brownouts?)

• Avoids need for Elasticity of Customer’s Work Force– No such thing as hire/fire at Internet speed

Page 14: Building Cloud-Native Applications with Microsoft Windows Azure

Cloud-Native Applications• Effort focuses on business functionality

– Development is highly productive– Time-to-market is short– Modification is straight-forward

• Infrastructure is not a limiting factor– Cost structure is a good fit– Downtime is not necessary– Scale is efficient

• Innovation / experimentation is enabled

Page 15: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Cloud Platform• The rise of focused, specialized services

– Really good at one thing– True of other Cloud Platforms

• “Scalable” Persistent Storage abstractions– Set of Services– Illusion of infinite scale out– Same performance with x clients as with 10x as with

100x as with 1000x as with …

• Billing model: pay only for what you use– Friction-free access to add’l or less storage

Page 16: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Storage Services in Concert

Page 17: Building Cloud-Native Applications with Microsoft Windows Azure

Scaling Out

Page 18: Building Cloud-Native Applications with Microsoft Windows Azure

Web Roles vs. Worker RolesWeb Role Worker Role

Runs in IIS 7(always listening)

Built using ASP.NET, MVCGood to handle interactive usersAddressable over InternetGood for hosting Web API (WCF)Runs ContinuouslyMaps to VM

Page 19: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Services – Examples

• Web Roles• Worker Roles• Queues

• Combining Roles and Queues– Asynchronous Work Queue Pattern

• Scale Out• Resilient to failure

Page 20: Building Cloud-Native Applications with Microsoft Windows Azure

Key Pattern: Roles + Queues

WebRole(IIS)

WebRole(IIS)

WorkerRole

WorkerRole

Queues

BlobsTables

Page 21: Building Cloud-Native Applications with Microsoft Windows Azure

Canonical Example: Thumbnails

WebRole(IIS)

WebRole(IIS)

WorkerRole

WorkerRole

Queues

BlobsTables

Page 22: Building Cloud-Native Applications with Microsoft Windows Azure

Adding to Queue - Conceptual

Page 23: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Blob Storage

Adding to Queue - Actual

Page 24: Building Cloud-Native Applications with Microsoft Windows Azure

Roles + Queues: API

WebRole(IIS)

WebRole(IIS)

WorkerRole

WorkerRole

Queues

queue.AddMessage( new CloudQueueMessage( statusUpdateMessage));

CloudQueueMessage statusUpdateMessage = queue.GetMessage( TimeSpan.FromSeconds(10));

… queue.DeleteMessage(statusUpdateMessage);

Page 25: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Queue Storage

• Service for RELIABLE message delivery• 7 days = default TTL for item to stay in queue• 30 seconds = default “invisibility window”• 8 KB = max size of a queued item• 500 = approx number of transactions a queue

can handle per second– Beware of “spinning” – may get throttled, disabled

• N = number of queues you can have (N >> 1)

Page 26: Building Cloud-Native Applications with Microsoft Windows Azure
Page 27: Building Cloud-Native Applications with Microsoft Windows Azure

Persistent Storage Services – Options

Type of Data Traditional Azure Way

Relational SQL Server SQL Azure

Blob File System, or SQL Server

Azure Blobs

File File System Azure Drives, or Azure Blobs

Reliable Queue MSMQ (maybe) Azure Queues

Non-Relational Azure Tables

Page 28: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Storage Services

• Family of specialized, complementary storage services– Abstractions– High level services

• Blobs + Queues + Tables + Drives1.Many features in common2.Plus each with its own differentiating features

Page 29: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Storage – Common Features

• RESTful API (http + XML + “resources”)http://bostonazure.table.core.windows.net/TableFoo?comp=list

• Operations - REST/http verb supportCreate = PUT Read = GETUpdate = POST Delete = DELETE

• Language agnostic• Client library provided for .NET by Microsoft

–Many other client libraries available

Page 30: Building Cloud-Native Applications with Microsoft Windows Azure

Authentication Requirements

• PUT, POST, DELETE are always Authenticated• GET is usually Authenticated

– Exception possible for Blobs – Blob GET access can be public if Blob Container

allows for Unauthenticated GET requests

• Sign http header using Access Key from Portal– Don’t need to code this (use Microsoft-

provided .NET client library)– Key lives in an Azure xml config file

Page 31: Building Cloud-Native Applications with Microsoft Windows Azure

Developer Portal for Keys

https://windows.azure.com/

Page 32: Building Cloud-Native Applications with Microsoft Windows Azure

Storage Keys for Authentication

Page 33: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Storage – Common Features

• Tables, Blobs, Queues, Drives all share the following features / characteristics

• Are all created under your Azure Storage Account

• Storage Account is usually created through the Developer Portal– Or API

Page 34: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Storage – Common Features

• Support for metadata (8k, unstructured)• Replicated so there are (at least) 3 copies

– Within in a single data center– Strongly consistent programming model

• Easy, fast to dynamically add new containers– No limit to number of instances of blobs, tables,

table rows, or queues

• Pay As You Go billing model

Page 35: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Blob Storage• The place to put ANY LARGE OBJECT• Private or Public• Public blobs can be anonymously accessed

– Images, videos, CSS files– Need not be binary

• Public blobs can be cached in Azure CDN– 20 locations around the world– Different locations than data centers

• Time-limited signed-access available– “You have until tomorrow to download this video”

Page 36: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Blob Storage

• Two types of Azure Blobs1.“Block Blob”

– Parallel upload scenarios– Resume download scenarios– Up to 200 GB

2.“Page Blob”– Random access scenarios– Azure Drives– Up to 1000 GB

Page 37: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Drive Storage

• Disk Drive simulation in cloud• Façade over an Azure Blob

– Specifically, Page Blob type

• Legacy-focused, not “cloud native”• Limits same as Page Blob limits

– 1000 GB = 1 TB

Page 38: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Table Storage

• Best place for granular, semi-structured data– No rigid database schema

• Fast and easy to instantiate– Strongly Consistent– No performance lag

• Programming model is WCF Data Services– All data access and data updates– LINQ

Page 39: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Table Storage

Storage Account

Table [*]

Entity [*, 1 MB data] PartitionKey + RowKey

Property [255x]Name/Value/Type

Up to 64k

Page 40: Building Cloud-Native Applications with Microsoft Windows Azure

Azure Table Storage

• Partition Key– Along a “logical grouping” – a “shard”– PartitionKey value of up to 64 KB

• Row Key– Identify specific row within a partition– RowKey value is String of up to 64 KB

• Table access requires Partition Key + Row Key– Not to mention (cryptographic) Access Key (for the

digital signing of the http header)

Page 41: Building Cloud-Native Applications with Microsoft Windows Azure

Relational Data vs. Azure TablesApproach SQL Azure Azure TablesNormalization Normalized Denormalized(Duplication) (No duplication) (Lots of duplication)

Structure Schema FlexibleTransactions Distributed Limited scopeResponsibility Database DeveloperKnobs Many FewScale Up (or Sharding) OutCost Reasonable Very

reasonable

Page 42: Building Cloud-Native Applications with Microsoft Windows Azure
Page 43: Building Cloud-Native Applications with Microsoft Windows Azure

Pay As You Go – Data TransferSQL Azure and Azure Storage

• Data in motion…• North America and Europe regions

– $0.10 per GB in– $0.15 per GB out

• (different costs in Asia)• No charge for transfer within a data center

Page 44: Building Cloud-Native Applications with Microsoft Windows Azure

Pay As You Go – StorageAzure Storage

• Data at rest…• Storage

– $0.15 per GB stored per month– $0.01 per 10,000 storage transactions

• Applies equally to:– Queues– Tables– Blobs

Page 45: Building Cloud-Native Applications with Microsoft Windows Azure

SQL Azure Pricing

• Data at rest…• 1 GB relational database = $10 / month• 10 GB relational database = $100 / month• 50 GB version coming

Page 46: Building Cloud-Native Applications with Microsoft Windows Azure

SQL Azure vs. Azure Storage

• Review and Simple Analysis…• 1 GB storage per month:

– $10 = SQL Azure – $0.15 = Azure Storage

• 10/0.15 = 66.67x

• Are the features worth the cost?

Page 47: Building Cloud-Native Applications with Microsoft Windows Azure

Geography

Page 48: Building Cloud-Native Applications with Microsoft Windows Azure

Geography Matters

• Select Data Center near customers• Keep data resources near compute resources

• Currently 6 data centers from which to choose• Additional 20 sites for CDN

Page 49: Building Cloud-Native Applications with Microsoft Windows Azure

Geography Matters

• Azure data centers1. North Central US2. South Central US3. West Europe4. North Europe5. East Asia6. Southeast Asia

• Anywhere options for: US, Europe, Asia

Data Center choices

Page 50: Building Cloud-Native Applications with Microsoft Windows Azure

Not new, but…

Page 51: Building Cloud-Native Applications with Microsoft Windows Azure

Accessible to mere mortalsLess complex, more cost-effective competitive pressure …

Your competitors are going to be doing it

Page 52: Building Cloud-Native Applications with Microsoft Windows Azure

Questions?

?

Page 53: Building Cloud-Native Applications with Microsoft Windows Azure

BostonAzure.org

• Boston Azure cloud user group• Focused on Microsoft’s cloud solution• Next meeting: 6-8 PM Thurs Sept 23nd 2010

– Hacking on “Boston Azure Project”– Intro to Cloud Computing on Windows Azure

• Meetings usually 4th Thursday of month– No cost; food; great topics; growing community; wifi

• Join email list: http://bostonazure.org• Follow on Twitter: @bostonazure

Page 54: Building Cloud-Native Applications with Microsoft Windows Azure

Slides available from Bill’s blog

http://blog.codingoutloud.com

hmbl.me is URL shortener running on Azure:

http://hmbl.me/2FPW3L

http://blog.codingoutloud.com/2010/07/14/key-architectural-design-pattern-for-cloud-native-azure-apps

Page 55: Building Cloud-Native Applications with Microsoft Windows Azure

Bill Wilder@codingoutloudhttp://blog.codingoutloud.com