Cloud Architecture Patterns for Mere Mortals New England Code Camp #16 29-October-2011 Copyright (c) 2011, Bill Wilder – Use allowed under Creative Commons.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Amazon RDS (MySQL and Oracle) and SQL Azure Emil Tabakov Telerik Software Academy academy.telerik.com.
Adding scalability to legacy PHP web applications Overview Mario A. Valdez-Ramirez.
Azure Services Platform Piotr Zierhoffer. Agenda Cloud? What is Azure? Environment Basic glossary Architecture Element description Deployment.
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.
Azure Awesomeness Dr. Zoran B. Djordjevic’s CSCI E-175 Cloud Computing and Software as a Service class, Harvard University, 04-Nov-2011 Copyright (c) 2011,
Summary To fully leverage cloud computing we need to understand both the strengths and weaknesses of the cloud. In this talk, we will demonstrate how the.
Big Ideas in Software Architecture (in cloud or otherwise) Boston Azure User Group 27-October-2011 Copyright (c) 2011, Bill Wilder – Use allowed under.
Massively Parallel Cloud Data Storage Systems S. Sudarshan IIT Bombay.
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)
How WebMD Maintains Operational Flexibility with NoSQL Rajeev Borborah, Sr. Director, Engineering Matt Wilson – Director, Production Engineering – Consumer.
STEALTH Content Store for SharePoint using Windows Azure  Boosting your SharePoint to the MAX! "Optimizing your Business behind the scenes"
Databases with Scalable capabilities Presented by Mike Trischetta.
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.
Components of Windows Azure - more detail. Windows Azure Components Windows Azure PaaS ApplicationsWindows Azure Service Model Runtimes.NET 3.5/4, ASP.NET,
Training Workshop Windows Azure Platform. Presentation Outline (hidden slide): Technical Level: 200 Intended Audience: Developers Objectives (what do.
What is Architecture  Architecture is a subjective thing, a shared understanding of a system’s design by the expert developers on a project  In the.
@codingoutloud © 2014 Development Partners Software Corporation Meet Windows Azure, Your Next Data Center nearing.
Sofia, Bulgaria | 9-10 October SQL Server 2005 High Availability for developers Vladimir Tchalkov Crossroad Ltd. Vladimir Tchalkov Crossroad Ltd.
Modern Databases NoSQL and NewSQL Willem Visser RW334.
Windows Azure Conference 2014 Deploy your Java workloads on Windows Azure.
WINDOWS AZURE STORAGE SERVICES A brief comparison and overview of storage services offered by Microsoft.
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)
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
Bill Wilder – brief bio Bill Wilder has been a professional software developer for more than 20 years. Last year he founded the Boston Azure User Group,
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.
INTRODUCTION TO DBS Database: a collection of data describing the activities of one or more related organizations DBMS: software designed to assist in.
Windows Azure. Azure Application platform for the public cloud. Windows Azure is an operating system You can: – build a web application that runs.
CS525: Big Data Analytics MapReduce Computing Paradigm & Apache Hadoop Open Source Fall 2013 Elke A. Rundensteiner 1.
Introduction.  Administration  Simple DBMS  CMPT 454 Topics John Edgar2.
Windows Azure Web Sites Second-generation PaaS Boston Cloud Meetup 14-January-2014 (00:30) Boston Azure User Group
Web Technologies Lecture 13 Introduction to cloud computing.
Scalability == Capacity * Density.
BASE Dan Pritchett, Ebay ACM Queue, May/June 2008.
Mark Gilbert Microsoft Corporation Services Taxonomy Building Block Services Attached Services Finished Services.
Architecture Patterns for Building Cloud-Native Applications NYC Code Camp 7 15-September-2012 (10:45 – noon) Boston Azure User Group
Technology Drill Down: Windows Azure Platform Eric Nelson | ISV Application Architect | Microsoft UK |
(re)-Architecting cloud applications on the windows Azure platform CLAEYS Kurt Technology Solution Professional Microsoft EMEA.
An Introduction to Super-Scalability But first…
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.
Scaling out and in with Azure SQL DB Elastic Scale DBA-203 Warner Chaves, MCM/MVP, SQLTurbo.com, Pythian.com.
BIG DATA/ Hadoop Interview Questions.
Cofax Scalability Document Version Scaling Cofax in General The scalability of Cofax is directly related to the system software, hardware and network.
Abstract MarkLogic Database – Only Enterprise NoSQL DB Aashi Rastogi, Sanket V. Patel Department of Computer Science University of Bridgeport, Bridgeport,
Amazon Web Services. Amazon Web Services (AWS) - robust, scalable and affordable infrastructure for cloud computing. This session is about:
Aaron Stanley King. What is SQL Azure? “SQL Azure is a scalable and cost-effective on- demand data storage and query processing service. SQL Azure is.
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.
Boston Code Camp October-2012 (1:30 – 2:40)
Cloud Architecture Patterns for Mere Mortals
N-Tier Architecture.
Maximum Availability Architecture Enterprise Technology Centre.
100% Exam Passing Guarantee & Money Back Assurance
NOSQL databases and Big Data Storage Systems
Architecture Patterns for Scalability & Reliability
Introduction of Week 3 Assignment Discussion
Hello Farmington! 4:30-5:30, then dinner.
Serverless CQRS in Azure!
New England Code Camp October-2010
Massively Parallel Cloud Data Storage Systems
Outline Virtualization Cloud Computing Microsoft Azure Platform
Demystifying the Cloud
microsoft cloud platform: enterprise-class architecture
Demystifying the Cloud
DevBoston 07-February-2013 (6:00 PM)
Building Scalable and Reliable Applications with Windows Azure
Building global and highly-available services using Windows Azure
NoSQL databases An introduction and comparison between Mongodb and Mysql document store.
Presentation transcript:

Cloud Architecture Patterns for Mere Mortals New England Code Camp #16 29-October-2011 Copyright (c) 2011, Bill Wilder – Use allowed under Creative Commons license Boston Azure User Group Bill Wilder Examples drawn from Windows Azure cloud platform

Bill Wilder Windows Azure MVP Windows Azure Consultant Boston Azure User Group Founder

What’s the Big Idea? 1.What is Scalability? 2.Scaling Data 3.Scaling Compute 4.Q&A

Key Concepts & Patterns GENERAL 1.Scale vs. Performance 2.Scale Up vs. Scale Out 3.Shared Nothing 4.Design for Failure DATABASE ORIENTED 5.ACID vs. BASE 6.Eventually Consistent 7.Sharding 8.Optimistic Locking COMPUTE ORIENTED 9.CQRS Pattern 10.Poison Messages 11.Idempotency

Key Terms 1.Scale Up 2.Scale Out 3.Horizontal Scale 4.Vertical Scale 5.Scale Unit 6.ACID 7.CAP 8.Eventual Consistency 9.Strong Consistency 10.Multi-tenancy 11.NoSQL 12.Sharding 13.Denormalized 14.Poison Message 15.Idempotent 16.CQRS 17.Performance 18.Scale 19.Optimistic Locking 20.Shared Nothing 21.Load Balancing 22.Design for Failure

Overview of Scalability Topics 1.What is Scalability? 2.Scaling Data 3.Scaling Compute 4.Q&A

Old School Excel and Word

Scale != Performance Scalable iff Performance constant as it grows Scale the Number of Users … Volume of Data … Across Geography Scale can be bi-directional (more or less) Investment α Benefit What does it mean to Scale?

Options: Scale Up (and Scale Down) or Scale Out (and Scale In) Terminology: Scaling Up/Down == Vertical Scaling Scaling Out/In == Horizontal Scaling Architectural Decision – Big decision… hard to change

Scaling Up: Scaling the Box.

Scaling Out: Adding Boxes “Shared nothing” scales best

How do I Choose???? ?????? … Scale Up (Vertically) Scale Out (Horizontally). Not either/or! Part business, part technical decision (requirements and strategy) Consider Reliability (and SLA in Azure) Target VM size that meets min or optimal CPU, bandwidth, space

Essential Scale Out Patterns Data Scaling Patterns Sharding: Logical database comprised of multiple physical databases, if data too big for single physical db NoSQL: “Not Only SQL” – a family of approaches using simplified database model Computational Scaling Patterns CQRS: Command Query Responsibility Segregation

Overview of Scalability Topics 1.What is Scalability? 2.Scaling Data Sharding NoSQL 3.Scaling Compute 4.Q&A

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)

Sharding is Difficult What defines a shard? (Where to put stuff?) – Example by geography: 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

SQL Azure is SQL Server Except… Common SQL Server Specific (for now) SQL Azure Specific “Just change the connection string…” Full Text Search Native Encryption Many more… Limitations 50 GB size limit New Capabilities Highly Available Rental model Coming: Backups & point-in-time recovery SQL Azure Federations More… Additional information on Differences:

SQL Azure 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 Not yet a released product – But coming soon to an Azure Data Center near you! federations-robust-connectivity-model-for-federated-data.aspx federations-robust-connectivity-model-for-federated-data.aspx

Overview of Scalability Topics 1.What is Scalability? (10 minutes) 2.Scaling Data (20 minutes) Sharding NoSQL 3.Scaling Compute (15 minutes) 4.Q&A (15 minutes)

Persistent Storage Services – Azure Type of DataTraditionalAzure Way RelationalSQL ServerSQL Azure BLOB (“Binary Large Object”) File System, SQL Server Azure Blobs FileFile System(Azure Drives) Azure Blobs LogsFile System, SQL Server, etc. Azure Blobs Azure Tables Non-RelationalAzure Tables NoSQL ?

Not Only SQL

NoSQL Databases (simplified!!!), CouchDB: JSON Document Stores Amazon Dynamo, Azure Tables: Key Value Stores – Dynamo: Eventually Consistent – Azure Tables: Strongly Consistent Many others! Faster, Cheaper Scales Out “Simpler”

Eventual Consistency Property of a system such that not all records of state guaranteed to agree at any given point in time. – Applicable to whole systems or parts of systems (such as a database) As opposed to Strongly Consistent (or Instantly Consistent) Eventual Consistency is natural characteristic of a useful, scalable distributed systems

Why Eventual Consistency? #1 ACID Guarantees: – Atomicity, Consistency, Isolation, Durability AtomicityConsistencyIsolationDurability – SQL insert vs read performance? How do we make them BOTH fast? Optimistic Locking and “Big Oh” math BASE Semantics: – Basically Available, Soft state, Eventual consistency Basically Available, Soft state, Eventual consistency From: and

Why Eventual Consistency? #2 CAP Theorem – Choose only two guarantees 1.Consistency: all nodes see the same data at the same timeConsistency 2.Availability: a guarantee that every request receives a response about whether it was successful or failedAvailability 3.Partition tolerance: the system continues to operate despite arbitrary message lossPartition tolerance From:

Cache is King Facebook has “28 terabytes of memcached data on 800 servers.” failures-caused-by-complex-weakly-interact.html failures-caused-by-complex-weakly-interact.html Eventual Consistency at work!

Relational (SQL Azure) vs. NoSQL (Azure Tables) ApproachRelational (e.g., SQL Azure) NoSQL (e.g., Azure Tables) NormalizationNormalizedDenormalized (Duplication)(No duplication)(Duplication okay) TransactionsDistributedLimited scope StructureSchemaFlexible ResponsibilityDBA/DatabaseDeveloper/Code KnobsManyFew ScaleUp (or Sharding) Out

NoSQL Storage Suitable for granular, semi-structured data (Key/Value stores) Document-oriented data (Document stores) No rigid database schema Weak support for complex joins or complex transaction Usually optimized to Scale Out NoSQL databases generally not managed with same tooling as for SQL databases

Overview of Scalability Topics 1.What is Scalability? 2.Scaling Data 3.Scaling Compute CQRS 4.Q&A

CQRS Architecture Pattern Command Query Responsibility Segregation Based on notion that actions which Update our system (“Commands”) are a separate architectural concern than those actions which ask for data (“Query”) Leads to systems where the Front End (UI) and Backend (Business Logic) are Loosely Coupled

CQRS in Windows Azure WE NEED: Compute resource 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; SQL Azure

CQRS in Action Web Server Compute Service Reliable Queue Reliable Storage

Canonical Example: Thumbnails Web Role (IIS) Web Role (IIS) Worker Role Worker Role Azure Queue Azure Blob Key Point: at first, user does not get the thumbnail (UX implications)

Reliable Queue & 2-step Delete (IIS) Web Role (IIS) Web Role Worker Role Worker Role queue.AddMessage( new CloudQueueMessage( urlToMediaInBlob)); CloudQueueMessage msg = queue.GetMessage( TimeSpan.FromSeconds(10)); … queue.DeleteMessage(msg); Queue

General Case: Many Roles, Many Queues Web Role (IIS) Web Role (IIS) Worker Role Worker Role Web Role (IIS) Web Role (IIS) Web Role (IIS) Web Role (IIS) Web Role (IIS) Web Role (IIS) 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 3 Queue Type 1 Queue Type 2 Queue Type 3 Remember: Investment α Benefit Watch your scale units! Logical vs. Physical Architecture

CQRS requires Idempotent If we perform idempotent operation more than once, end result same as if we did it once Example with Thumnailing (easy case) App-specific concerns dictate approaches – Compensating transactions – Last in wins – Many others possible – hard to say

CQRS expects Poison Messages A Poison Message cannot be processed – Error condition for non-transient reason – Queue feature: know your dequeue count CloudQueueMessage.DequeueCount property in Azure Be proactive – Falling off the queue may kill your system Message TTL = 7 days by default in Azure Determine a max Retry policy – May differ by queue object type or other criteria – Delete, Move to Special Queue

CQRS enables Responsive Response to interactive users is as fast as a work request can be persisted Time consuming work done off-line Comparable total resource consumption, arguably better subjective UX UX challenge – how to express Async to users? – Communicate Progress – Display Final results

CQRS enables Scalable Loosely coupled, concern-independent scaling – Getting Scale Units right Blocking is Bane of Scalability – Decoupled front/back ends insulate from other system issues if… – Twitter down – server unreachable – Order processing partner doing maintenance – Internet connectivity interruption

CQRS enables Distribution Scale out systems better suited for geographic distribution – More efficient and flexible because more granular – Hard for a mega-machine to be in more than one place – Failure need not be binary

CQRS requires Plan for Failure There will be VM (or Azure role) restarts – Hardware failure, O/S patching, crash (bug) Bake in handling of restarts – Idempotent Not an exception case! Expect it! Restarts are routine, system “just keeps working”

Typical SiteAny 1 Role InstOverall System Operating System Upgrade Application Update / Deploy Change Topology Hardware Failure Software Bug / Crash / Failure Security Patch What’s Up? Aspirin-free Reliability as EMERGENT PROPERTY

CQRS enables Resilient And Requires that you “Plan for failure” There will be VM (or Azure role) restarts Bake in handling of restarts – Not an exception case! Expect it! – Restarts are routine, system “just keeps working” If you follow the pattern, the payoff is substantial…

What about the DATA? Azure Web Roles and Azure Worker Roles – Taking user input, dispatching work, doing work – Follow CQRS pattern – Stateless compute nodes “Hard Part” – persistent data, scalable data – Azure Queue, Blob, Table, SQL Azure – 3x copies of each byte – Blobs and Tables geo-replicated – Retry and Throttle!

Division of Labor Client- facing code dealing with #fail Backoffice code dealing with #Fail Reliable Queuing Reliable Storage #fail, #Fail, #EpicFail

Overview of Scalability Topics 1.What is Scalability? 2.Scaling Data 3.Scaling Compute 4.Q&A Summary Questions? Feedback? Stay in touch

4 Big Ideas to Take Home 1.Code for #fail ; architect for #Fail; architect (or not!) for #EpicFail! 2.Consider flexibility of Scale Out architecture – Scalable, Resilient, Testable, Cost-appropriate – Computation: Queues, Storage, CQRS – Data: SQL Azure Federations, NoSQL (Azure Tables) 3.Look for Eventual Consistency opportunities – Caching, CDN, CQRS, Non-transactional Data Updates, Optimistic Locking 4.Embrace platforms with affordances for future-looking architecture – e.g., Windows Azure Platform (PaaS)

Questions? Comments? More information? ?

BostonAzure.org Boston Azure cloud user group Focused on Microsoft’s PaaS cloud platform Last Thursday, monthly, 6:00-8:30 PM at NERD – Food; wifi; free; great topics; growing community Boston Azure Boot Camp: 2012 (in planning) 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