Architecture Patterns for Building Cloud-Native Applications NYC Code Camp 7 15-September-2012 (10:45 – noon) Boston Azure User Group

Slides:



Advertisements
Similar presentations
Architecting to be Cloud Native On Windows Azure or Otherwise
Advertisements

“Try not. Do, or do not. There is no try.” - Yoda
“Try not. Do, or do not. There is no try.” - Yoda
System Center 2012 R2 Overview
What’s New in Windows Azure A platform overview + how it can fit into my development shop today… New England Microsoft Dev Group 06-June-2013 (6:30-8:30.
Microsoft Azure Cloud Platform an overview
Page 1 Ricardo Villalobos Windows Azure Architect Evangelist Microsoft Corporation Designing, Building, and Deploying Windows Azure applications.
“It’s going to take a month to get a proof of concept going.” “I know VMM, but don’t know how it works with SPF and the Portal” “I know Azure, but.
Overview Of Microsoft New Technology ENTER. Processing....
Big Ideas in Software Architecture (in cloud or otherwise) 14-December-2011 Copyright (c) 2011, Bill Wilder – Use allowed under Creative Commons license.
B UILDING M ULTI - TIER W EB A PPLICATIONS IN V IRTUAL E NVIRONMENTS.
Inside Windows Azure Virtual Machines Vijay Rajagopalan Microsoft Corporation.
INTRODUCTION TO CLOUD COMPUTING Cs 595 Lecture 5 2/11/2015.
Plan Introduction What is Cloud Computing?
VM Role (PaaS)Virtual Machine (IaaS) StorageNon-Persistent StoragePersistent Storage Easily add additional storage DeploymentBuild VHD offsite and upload.
Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)
A Brief Overview by Aditya Dutt March 18 th ’ Aditya Inc.
Cloud Computing for the Enterprise November 18th, This work is licensed under a Creative Commons.
Cloud MapReduce : a MapReduce Implementation on top of a Cloud Operating System Speaker : 童耀民 MA1G Authors: Huan Liu, Dan Orban Accenture.
Cloud Computing Saneel Bidaye uni-slb2181. What is Cloud Computing? Cloud Computing refers to both the applications delivered as services over the Internet.
Cloud computing is the use of computing resources (hardware and software) that are delivered as a service over the Internet. Cloud is the metaphor for.
Components of Windows Azure - more detail. Windows Azure Components Windows Azure PaaS ApplicationsWindows Azure Service Model Runtimes.NET 3.5/4, ASP.NET,
Introduction To Windows Azure Cloud
Training Workshop Windows Azure Platform. Presentation Outline (hidden slide): Technical Level: 200 Intended Audience: Developers Objectives (what do.
INFO 344 Web Tools And Development CK Wang University of Washington Spring 2014.
Migrating Business Apps to Windows Azure Marc Müller Principal Consultant, 4tecture GmbH
@codingoutloud © 2014 Development Partners Software Corporation Meet Windows Azure, Your Next Data Center nearing.
@codingoutloud © 2014 Development Partners Software Corporation © 2014 Development Partners Software.
Windows Azure Conference 2014 Deploy your Java workloads on Windows Azure.
Overview of Cloud Computing Sven Rosvall ACCU
1 Moshe Shadmon ScaleDB Scaling MySQL in the Cloud.
Plan  Introduction  What is Cloud Computing?  Why is it called ‘’Cloud Computing’’?  Characteristics of Cloud Computing  Advantages of Cloud Computing.
Azure Best Practices How to Successfully Architect Windows Azure Apps for the Cloud 13-Mar-2013 (1:00 PM EDT) Bill Wilder An App in the Cloud is not (necessarily)
DISTRIBUTED COMPUTING Introduction Dr. Yingwu Zhu.
Except where noted contents © 2014 Development Partners Software Corporation Cloud Architecture Anti-Patterns.
Cloud-Native in Azure Zoran B. Djordjevic’s CSCI E-175 Cloud Computing and Software as a Service class at Harvard University 19-November-2010 Copyright.
Visual Studio Windows Azure Portal Rest APIs / PS Cmdlets US-North Central Region FC TOR PDU Servers TOR PDU Servers TOR PDU Servers TOR PDU.
Windows Azure. Azure Application platform for the public cloud. Windows Azure is an operating system You can: – build a web application that runs.
Zvezdan Pavković. Storage Non-Persistent Storage Persistent Storage Easily add additional storage. Networking Internal and Input Endpoints configured.
Windows Azure Web Sites Second-generation PaaS Boston Cloud Meetup 14-January-2014 (00:30) Boston Azure User Group
3/12/2013Computer Engg, IIT(BHU)1 CLOUD COMPUTING-1.
Web Technologies Lecture 13 Introduction to cloud computing.
Scalability == Capacity * Density.
Cloud Architecture Patterns for Mere Mortals New England Code Camp #16 29-October-2011 Copyright (c) 2011, Bill Wilder – Use allowed under Creative Commons.
Except where noted contents © 2014 Development Partners Software Corporation the Microsoft Azure.
Except where noted contents © 2014 Development Partners Software Corporation the Microsoft Azure.
Microsoft Cloud Computing. Topics to be covered 1.Environmental Features of windows azure 2.What is Cloud Computing 3.Roles in Cloud Computing 4.Benefits.
Windows Azure Overview for IT Pros Anton Boyko. Intro to Cloud Computing Intro to Windows Azure Cloud Services Web Sites Virtual Machines Workload Options.
Hello Cloud… Mike Benkovich
Building Cloud Solutions Presenter Name Position or role Microsoft Azure.
(re)-Architecting cloud applications on the windows Azure platform CLAEYS Kurt Technology Solution Professional Microsoft EMEA.
Cloud Computing from a Developer’s Perspective Shlomo Swidler CTO & Founder mydrifts.com 25 January 2009.
Inspirirani ljudima. Ugasite mobitele. Hvala.. Paolo Pialorsi Senior Consultant PiaSys ( Publishing apps for SharePoint 2013 on Microsoft.
 Cloud Computing technology basics Platform Evolution Advantages  Microsoft Windows Azure technology basics Windows Azure – A Lap around the platform.
BIG DATA/ Hadoop Interview Questions.
Amazon Web Services. Amazon Web Services (AWS) - robust, scalable and affordable infrastructure for cloud computing. This session is about:
Cloud-Native Architecture Patterns (Or… why your pre-cloud architecture won’t work so well in the cloud) Azure Florida Association 28-March-2012 Boston.
Platform as a Service (PaaS)
Boston Code Camp October-2012 (1:30 – 2:40)
Cloud Architecture Patterns for Mere Mortals
Deploying Web Application
Platform as a Service (PaaS)
Logo here Module 3 Microsoft Azure Web App. Logo here Module Overview Introduction to App Service Overview of Web Apps Hosting Web Applications in Azure.
Architecture Patterns for Scalability & Reliability
Hello Farmington! 4:30-5:30, then dinner.
New England Code Camp October-2010
Outline Virtualization Cloud Computing Microsoft Azure Platform
DevBoston 07-February-2013 (6:00 PM)
5 Azure Services Every .NET Developer Needs to Know
Building global and highly-available services using Windows Azure
Presentation transcript:

Architecture Patterns for Building Cloud-Native Applications NYC Code Camp 7 15-September-2012 (10:45 – noon) Boston Azure User Group Bill Wilder Bill Wilder

My name is Bill Wilder Bill Wilder

NYCC7 is brought to you by… … a handful of organizers … a cadre of speakers, and … a bunch of really great $ pon $ or $ Be sure to thank them for making NYC Code Camp 7 possible!

MARQUEE SPONSOR

PLATINUM SPONSOR

GOLD SPONSORS

SILVER SPONSORS

Who is Bill Wilder?

I will ass-u-me… 1.You know what “the cloud” is 2.You have an inkling about Amazon Web Services and Windows Azure cloud platforms 3.You understand that such cloud platforms include compute services [like hosted virtual machines (VMs), in both IaaS and PaaS modes], SQL and NoSQL database services, file storage services, messaging, DNS, management, etc. 4.You are interested in understanding cloud- native applications

Roadmap for rest of talk… … 1.Give context and definition for cloud-native 2.Cover three specific patterns for building cloud-native applications 3.Mention several other patterns Q&A during talk is okay (time permitting) Q&A at end with any remaining time Also feel free to join me for lunch to talk cloud ?

Cloud Platform Characteristics Scaling – or “resource allocation” – is horizontal – and ∞ (“illusion of infinite resources”) Resources are easily added or released – self-service portal or API; cloud scaling is automatable Pay only for currently allocated resources – costs are operational, granular, controllable, and transparent Optimized for cost-efficiency – cloud services are MT, hardware is commodity – MTTR over MTTF Rich, robust functionality is simply accessible – like an iceberg

Cloud-Native Application Characteristics Application architecture is aligned with the cloud platform architecture – uses the platform in the most natural way – lets the platform do the heavy lifting Are loosely coupled – for scalability, reliability, and flexibility Scale horizontally, automatically, bidirectionally – maintaining UX and cost-optimizing – scale operationally along with capacity Handle busy signals and node failures – without unnecessary UX degradation Use geo-distribution services – minimize network latency

Know the rules “If I had asked people what they wanted, they would have said faster horses.” - Henry Ford

Know the rules “If I had asked IT departments what they wanted, they would have said IaaS.” - Henry Cloud

Use the right tool for the job… Better on water than on land…. sorta “unreliable”when used on land.

Modern Application Challenges 1.Scaling compute 2.Scaling data 3.Scaling geographically 4.Handling failure … and all while maintaining User Experience (UX) Example patterns we will review: a.Horizontal Scaling b.Queue-Centric Workflow c.Database Sharding d.Other patterns briefly as time permits

Pre-Cloud vs. Cloud-Native Old-School vs. Cloud- Native ControlEfficiency Stable/Static HardwareDynamic/∞ Resources Fixed/CapExVariable/OpEx Vertical ScalingHorizontal Resourcing Minimize MTBFMinimize MTTR Data Storage = RDBMSScenario-specific Storage Manage InfrastructureManaged Infrastructure architectural concerns

Horizontal Scaling Compute Pattern pattern 1 of 3

What’s the difference between performance and scale? ?

Common Terminology: Scaling Up/Down  Vertical Scaling Scaling Out/In  Horizontal “Scaling”  But really is Horizontal Resource Allocation Architectural Decision – Big decision… hard to change Scale Up (and Scale Down??) vs. Horizontal Resourcing

Vertical Scaling (“Scaling Up”). Resources that can be “Scaled Up” Memory: speed, amount CPU: speed, number of CPUs Disk: speed, size, multiple controllers Bandwidth: higher capacity pipe … and it sure is EASY Downsides of Scaling Up Hard Upper Limit HIGH END HARDWARE  HIGH END CO$T Lower value than “commodity hardware” May have no other choice (architectural)

Scaling Horizontally: Adding Boxes autonomous nodes for scalability (stateless web servers, shared nothing DBs, your custom code in QCW)

Load Balancer (Cloud Service) Managed VMs (Cloud Service) Example: Web Tier

1.Auto-Scale Bidirectional 2.Nodes can fail Auto-Scale is only one cause Handle shutdown signals Stateless (“like a taxi”) vs. Sticky Sessions Stateless nodes vs. Stateless apps N+1 rule vs. occasional downtime (UX) Horizontal Scaling Considerations

How many users does your cloud-native application need before it needs to be able to horizontally scale? ?

Queue-Centric Workflow Pattern (QCW for short) pattern 2 of 3

Extend example into next Tier QCW enables applications where the UI and back-end services are Loosely Coupled (Compare to CQRS at the end)

QCW Example: User Uploads Photo Web Server Compute Service Reliable Queue Reliable Storage

QCW WE NEED: Compute (VM) resources to run our code Reliable Queue to communicate Durable/Persistent Storage

Where does Windows Azure fit?

QCW [on Windows Azure] WE NEED: Compute (VM) resources to run our code Web Roles (IIS) and Worker Roles (w/o IIS) Reliable Queue to communicate Azure Storage Queues Durable/Persistent Storage Azure Storage Blobs & Tables; WASD

QCW on Azure: User Uploads a Photo Web Role (IIS) Web Role (IIS) Worker Role Worker Role Azure Queue Azure Blob UX implications: user does not wait for thumbnail (architecture!) push pull

QCW enables Responsive UX Response to interactive users is as fast as a work request can be persisted Time consuming work done asynchronously Comparable total resource consumption, arguably better subjective UX UX challenge – how to express Async to users? – Communicate Progress – Display Final results – Long Polling/Web Sockets (e.g., SignalR or Node.io)

QCW enables Scalable App Decoupled front/back provides insulation – Blocking is Bane of Scalability – Order processing partner doing maintenance – Twitter down – server unreachable – Internet connectivity interruption Loosely coupled, concern-independent scaling – (see next slide) – Get Scale Units right

General Case: Many Roles, Many Queues Web Role (IIS) Web Role (IIS) Worker Role Worker Role Web Role (IIS) Web Role (IIS) Web Role (Public) Web Role (Public) Worker Role Worker Role Worker Role Worker Role Worker Role Type 1 Worker Role Type 1 Worker Role Worker Role Worker Role Worker Role Worker Role Worker Role Worker Role Type 2 Worker Role Type 2 Queue Type 1 Queue Type 2 Queue Type 1 Queue Type 2 Queue Type 3 Scaling best when Investment α Benefit Optimize for CO$T EFFICIENCY Logical vs. Physical Architecture Worker Role Type 2 Worker Role Type 2 Worker Role Type 2 Worker Role Type 2 Worker Role Type 2 Worker Role Type 2 Web Role (Admin) Web Role (Admin)

Reliable Queue & 2-step Delete (IIS) Web Role (IIS) Web Role Worker Role Worker Role var url = “ queue.AddMessage( new CloudQueueMessage( url ) ); var invisibilityWindow = TimeSpan.FromSeconds( 10 ); CloudQueueMessage msg = queue.GetMessage( invisibilityWindow ); (… do some processing then …) queue.DeleteMessage( msg ); Queue

QCW requires Idempotent Perform idempotent operation more than once, end result same as if we did it once Example with Thumbnailing (easy case) App-specific concerns dictate approaches – Compensating action, Last write wins, etc. PARTNERSHIP: division of responsibility between cloud platform & app – Far cry from database transaction

QCW expects Poison Messages A Poison Message cannot be processed – Error condition for non-transient reason – Use dequeue count property Be proactive – Falling off the queue may kill your system Determine a Max Retry policy per queue – Delete, put on “bad” queue, alert human, …

QCW requires “Plan for Failure” VM restarts will happen – Hardware failure, O/S patching, crash (bug) Bake in handling of restarts into our apps – Restarts are routine: system “just keeps working” – Idempotent support needed important – Event Sourcing (commonly seen with CQRS) may help Not an exception case! Expect it! Consider N+1 Rule

Typical SiteAny 1 Role InstOverall System Operating System Upgrade Application Code Update Scale Up, Down, or In Hardware Failure Software Failure (Bug) Security Patch What’s Up? Reliability as EMERGENT PROPERTY

Aside: Is QCW same as CQRS? Short answer: “no” CQRS – Command Query Responsibility Segregation Commands change state Queries ask for current state Any operation is one or the other Sometimes includes Event Sourcing Sometimes modeled using Domain Driven Design (DDD)

What about the DATA? You: Azure Web Roles and Azure Worker Roles – Taking user input, dispatching work, doing work – Follow a decoupled queue-in-the-middle pattern – Stateless compute nodes Cloud: “Hard Part”: persistent, scalable data – Azure Queue & Blob Services – Three copies of each byte – Blobs are geo-replicated – Busy Signal Pattern

Database Sharding Pattern pattern 3 of 3

Foursquare is a Social Network

Foursquare #Fail October 4, 2010 – trouble begins… After 17 hours of downtime over two days… “Oct. 5 10:28 p.m.: Running on pizza and Red Bull. Another long night.” WHAT WENT WRONG?

What is Sharding? Problem: one database can’t handle all the data – Too big, not performant, needs geo distribution, … Solution: split data across multiple databases – One Logical Database, multiple Physical Databases Each Physical Database Node is a Shard Most scalable is Shared Nothing design – May require some denormalization (duplication)

All shard have same schema SHARDS

Sharding is Difficult What defines a shard? (Where to put stuff?) – Example – use country of origin: customer_us, customer_fr, customer_cn, customer_ie, … – Use same approach to find records What happens if a shard gets too big? – Rebalancing shards can get complex – Foursquare case study is interesting Query / join / transact across shards Cache coherence, connection pool management

Where does Windows Azure fit?

Windows Azure SQL Database (WASD) is SQL Server Except… Common SQL Server Specific (for now) WASD Specific “Just change the connection string…” Full Text Search Native Encryption Many more… Limitations 150 GB size limit Busy Signal Pattern Colocation Pattern New Capabilities Managed Service Highly Available Rental model Federations Additional information on Differences:

Windows Azure SQL Databse Federations for Sharding Single “master” database – “Query Fanout” makes partitions transparent – Instead of customer_us, customer_fr, etc… we are back to customer database Handles redistributing shards Handles cache coherence Simplifies connection pooling No MERGE, only SPLIT currently federations-robust-connectivity-model-for-federated-data.aspx federations-robust-connectivity-model-for-federated-data.aspx

Foursquare #Fail Foursquare was implementing database sharding in the application layer. WASD Federations makes this unnecessary. WHAT WENT WRONG?

My database instance is limited to 150 GB. ∞ ∞ ∞ Does that mean the cloud doesn’t really offer the illusion of infinite resources? ?

Pre-Cloud vs. Cloud-Native Lessons : being Cloud- Native 1:15,000Efficiency Auto-Scaling via APIDynamic/∞ Resources Pay-As-You-GoVariable/OpEx Stateless, AutonomousHorizontal Resourcing N+1, IdempotentMinimize MTTR SQL, NoSQL, BlobScenario-specific Storage VM, Storage, LB, DRManaged Infrastructure

Know the rules “Know the rules well, so you can break them effectively.” - Dalai Lama XIV

Cloud Architecture Patterns book Primer Chapters 1.Scalability 2.Eventual Consistency 3.Multitenancy and Commodity Hardware 4.Network Latency

Cloud Architecture Patterns book Pattern Chapters 1.Horizontally Scaling Compute Pattern 2.Queue-Centric Workflow Pattern 3.Auto-Scaling Pattern 4.MapReduce Pattern 5.Database Sharding Pattern 6.Busy Signal Pattern 7.Node Failure Pattern 8.Colocate Pattern 9.Valet Key Pattern 10.CDN Pattern 11.Multisite Deployment Pattern

Questions? Comments? More information? ?

BostonAzure.org Boston Azure cloud user group Focused on Microsoft’s PaaS cloud platform Monthly, 6:00-8:30 PM in Boston area – Food; wifi; free; great topics; growing community Follow on More info or to join our Meetup.com group:

Contact Me Looking for … consulting help with Windows Azure Platform? someone to bounce Azure or cloud questions off? a speaker for your user group or company technology event? Just Ask! Bill community inquiries: business inquiries:

DONE