building cloud-native applications with microsoft windows azure

Post on 12-Jan-2015

2.294 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

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.

TRANSCRIPT

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

Agenda

?

What is “the cloud”?

?

The Cloud Opportunity

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

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

The Cloud Provides…

1. Efficient Scalability2. Elasticity on Demand3. Complexity Reduction

through Abstraction4. A few new challenges

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

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”

Most $$$ part of Software System?

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

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

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

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

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

Azure Storage Services in Concert

Scaling Out

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

Azure Services – Examples

• Web Roles• Worker Roles• Queues

• Combining Roles and Queues– Asynchronous Work Queue Pattern

• Scale Out• Resilient to failure

Key Pattern: Roles + Queues

WebRole(IIS)

WebRole(IIS)

WorkerRole

WorkerRole

Queues

BlobsTables

Canonical Example: Thumbnails

WebRole(IIS)

WebRole(IIS)

WorkerRole

WorkerRole

Queues

BlobsTables

Adding to Queue - Conceptual

Azure Blob Storage

Adding to Queue - Actual

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);

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)

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

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

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

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

Developer Portal for Keys

https://windows.azure.com/

Storage Keys for Authentication

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

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

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”

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

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

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

Azure Table Storage

Storage Account

Table [*]

Entity [*, 1 MB data] PartitionKey + RowKey

Property [255x]Name/Value/Type

Up to 64k

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)

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

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

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

SQL Azure Pricing

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

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?

Geography

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

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

Not new, but…

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

Your competitors are going to be doing it

Questions?

?

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

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

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

top related