Azure Best Practices How to Successfully Architect Windows Azure Apps for the Cloud

  • Published on

  • View

  • Download


HELLO my name is. Azure Best Practices How to Successfully Architect Windows Azure Apps for the Cloud. Bill Wilder. 13-Mar-2013 (1:00 PM EDT). An App in the Cloud is not (necessarily) a Cloud-Native App. Who is Bill Wilder?. - PowerPoint PPT Presentation


<p>11 Scalability Concepts Every Architect Should Understand - slides</p> <p>Azure Best PracticesHow to Successfully Architect Windows Azure Apps for the Cloud13-Mar-2013 (1:00 PM EDT) </p> <p>HELLOmy name isBill Wilder</p> <p>An App in the Cloud is not (necessarily)a Cloud-Native App1Abstract:Discover how you can successfully architect Windows Azure-based applications to avoid and mitigate performance and reliability issues with our live webinar </p> <p>Microsofts Windows Azure cloud offerings provide you with the ability to build and deliver a powerful cloud-based application in a fraction of the time and cost of traditional on-premise approaches.So whats the problem? Tried-and-true traditional architectural concepts dont apply when it comes to cloud-native applications. Building cloud-based applications must factor in answers to such questions as: </p> <p> How to scale? How to overcome failure? How to build a manageable system? How to minimize monthly bills from cloud vendors? </p> <p>During this webinar, we will examine why cloud-based applications must be architected differently from that of traditional applications, and break down key architectural patterns that truly unlock cloud benefits. Items of discussion include: </p> <p> Architecting for success in the cloud Getting the right architecture and scalability Auto-scaling in Azure and other cloud architecture patterns </p> <p>If you want to avoid long nights, help-desk calls, frustrated business owners and end-users, then dont miss this webinar or your chance to learn how to deliver highly-scalable, high-performance cloud applications.Who is Bill Wilder?</p> <p></p> <p>2Roadmap for this talk App in the Cloud != Cloud App (or at least not a Cloud-Native App)Put Cloud-Native in context of cloud platform types from software development point of viewHow to keep running when things go wrong?How to scale?How to minimize costs?</p> <p>Assumptions: You know what the cloud is so we can focus on application architecture using cloud as a toolboxYou are interested in understanding cloud-native apps</p> <p>?</p> <p>Consider the value spectrum and tipping point</p> <p>QUESTIONS AT THE END but ask as we go alongCONCEPTS ARE GENERAL but technology examples all use Windows Azure</p> <p>3The term cloud is nebulousThe term cloud is nebulousBring Your Own ____ as a ServicePaaSIaaSSaaS morelessResponsibility &amp; FlexibilityNIST: productive platforms for Cloud-Native AppsNIST TERMINOLOGY</p> <p>Our concern: Custom Applications (which rules out SaaS), and constructed to be Cloud-Native5What is different about the cloud?What's different about the cloud?^public</p> <p>^ public61/9th above water</p> <p> TTM &amp; Sleeping well= </p> <p>According to wikipedia ( typically only one-ninth of the volume of an iceberg is above waterIceberg comment not specific to CLOUD NATIVE but just a reminder to the power of the CLOUD</p> <p>Photo credit: MTTR</p> <p>commodity hardware + multitenant services= cost-efficient cloudfailure is routine(so you better be good at handling it)Photos from Bill Wilder</p> <p>cloud services are MT, hardware is commodity</p> <p>Cloud services CAN FAIL you need to implement Busy Signal Pattern and YOUR SERVICES CAN FAIL8This bar is always open</p> <p>*and* </p> <p>has an API</p> <p>Pay by the DrinkPhoto from Bill Wilder9Resource allocation (scaling) is:HorizontalBi-directionalAutomatableThe illusion of infinite resourcesCloud-Native Applications have their Application Architecture aligned with the Cloud Platform ArchitectureUse the platform in the most natural wayLet the platform do the heavy lifting where appropriateTake responsibility for error handling, self-healing, and some aspects of scalingCloud-Native Application Characteristics3- or N-tier, SOAMulti-data centerHorizontal scalingExpects failurePaaSTraditional Cloud-Native</p> <p>2-tierSingle data centerVertical scalingIgnores failureHardware or IaaSLess flexibleMore manual/attentionLess reliable (SPoF)Maintenance windowLess scalable, more $$Agile/faster TTMAuto-scalingSelf-healingHAGeo-LB/FO</p> <p>TELLS/CLUESCONSEQUENCESTells: Traditional vs Cloud-Native Which is best architecture?</p> <p>There is no best architecture it is situational, a Technical Business Decision.</p> <p>Cloud-native popularity growing in proportion to the shrinking cost and competitive benefits.</p> <p>Also.. CI, CD, Eventual Consistency, 12Putting Cloud Services to workPutting the cloud to work Web Tier Web Tierpageofphotos.comOriginal Approach2-tier architectureStateful web nodesProsWell understoodEasy to get working[Potential] ConsUX fails for upgrades, hardware failures, app pool recyclingLimited scaleNot Cloud-NativeDatabase</p> <p>/mauraNothing fundamental changes if we have two nodes in the Web Tier Still statefulNow needs sticky sessions (single node is degenerate case)</p> <p>Non-cloud-native is not WRONG, just DIFFERENT (but is wrong for the PaaS cloud)14 Web Tier Web Tierpageofphotos.comScale web tier (stateless)Scale service tier (async)Scale data tier (shard)All whilehandling failure and optimizing for cost- &amp; operational- efficiency Scale the app, not the team!Database</p> <p>Service TierService TierDatabase/mauraCost-efficiency dont rent hotel rooms when you dont need them</p> <p>Operational efficiency manage many more servers w/o needing much more time</p> <p>15Horizontal Scaling Compute Patternpattern 1 of 5Common Terminology:Scaling Up/Down Vertical ScalingScaling Out/In Horizontal Scaling But really is Horizontal Resource Allocation</p> <p>Architectural DecisionBig decision hard to change</p> <p>Vertical Scalingvs. Horizontal ScalingVertical Scaling (Scaling Up).Resources that can be Scaled UpMemory: speed, amount CPU: speed, number of CPUsDisk: speed, size, multiple controllersBandwidth: higher capacity pipe and it sure is EASYDownsides of Scaling UpHard Upper LimitHIGH END HARDWARE HIGH END CO$TLower value than commodity hardwareMay have no other choice (architectural)</p> <p>18Horizontal Scaling (Scaling Out)Autonomous nodes for scalability(stateless web servers, shared nothing DBs, your custom code in QCW)Autonomous nodes*and*Homogeneous nodes for operational simplicity*and*Anonymous nodesdont get emotionally involved!This is how a [public] CLOUD PLATFORM works *and*This is how YOUR CLOUD-NATIVE app worksLoad Balancer(Cloud Service)Managed VMs(Cloud Service)Web RoleExample: Web Tier</p> <p>Architectural concerns</p> <p>N&gt;1N+1Reactive20Auto-Scale BidirectionalNodes can failReleasing VM resources (e.g., via Auto-Scale) is one causeHandle shutdown signalsExternalize session statee.g., see ASP.NET Session State Providers for Azure Tables, Azure CacheN+1 rule as UX optimizationHorizontal Scaling Considerations</p> <p>Architectural concerns</p> <p>N&gt;1N+1Reactive</p> <p>Stateless (like a taxi)vs. Sticky SessionsStateless nodesvs. Stateless apps</p> <p>21How many users does your cloud-native application need before it needs to be able to horizontally scale??SLA, practical reasons22Whats the difference between performance and scale??SLA, practical reasons23Queue-Centric Workflow Pattern(QCW for short)pattern 2 of 5Extend into a new Service TierQCW enables applications where the UI and back-end services are Loosely Coupled</p> <p>[ Similar to CQRS Pattern ] Web Tier Web Tierpageofphotos.comAdd service tier (async)Leave Web Tier to do what its good at</p> <p>Database</p> <p>Service TierService Tier/mauraCost-efficiency dont rent hotel rooms when you dont need them</p> <p>Operational efficiency manage many more servers w/o needing much more time</p> <p>26QCW Example: User Uploads Photo www.pageofphotos.comWeb TierService TierReliable QueueReliable StorageAJAX orthogonal concernWorker Role not related to HTML 5 concept of Web Worker27QCWWE NEED:Compute (VM) resources to run our code Reliable Queue to communicate Durable/Persistent Storage Where does Windows Azure fit?</p> <p>QCW [on Windows Azure]WE NEED:Compute (VM) resources to run our codeWeb Roles (IIS Web Tier) Worker Roles (w/o IIS Service Tier)Reliable Queue to communicateAzure Storage QueuesDurable/Persistent StorageAzure Storage Blobs</p> <p>QCW on Azure: User Uploads a PhotoWebRole(IIS)WorkerRole</p> <p>Azure QueueAzure BlobUX implications: how does user know thumbnail is ready?</p> <p>www.pageofphotos.compushpullAJAX orthogonal concernWorker Role not related to HTML 5 concept of Web WorkerThumbnails sample code available from</p> <p>31QCW enables Responsive UXResponse to interactive users is as fast as a work request can be persistedTime consuming work done asynchronouslyComparable total resource consumption, arguably better subjective UXUX challenge how to express Async to users?Communicate ProgressDisplay Final resultsLong Polling/Web Sockets (e.g., SignalR or enables Scalable AppDecoupled front/back provides insulationBlocking is Bane of ScalabilityOrder processing partner doing maintenanceTwitter downEmail server unreachableInternet connectivity interruptionLoosely coupled, concern-independent scaling(see next slide)Get Scale Units rightKey to optimizing operational CO$T$General Case: Many Roles, Many QueuesWebRole(IIS)WorkerRoleWebRole(IIS)WebRole(Public)WorkerRoleWorkerRoleWorkerRole Type 1WorkerRoleWorkerRoleWorkerRoleWorkerRole Type 2Queue Type 1Queue Type 2Queue Type 1Queue Type 2Queue Type 3 Scaling is best when Investment Benefit Optimize for CO$T EFFICIENCY Logical vs. Physical Architecture depends on current scaleWorkerRole Type 2WorkerRole Type 2WorkerRole Type 2WebRole(Admin)34Reliable Queue &amp; 2-step DeleteWebRoleWorkerRolevar url =;queue.AddMessage( new CloudQueueMessage( url ) );var invisibilityWindow = TimeSpan.FromSeconds( 10 );CloudQueueMessage msg = queue.GetMessage( invisibilityWindow );// do all necessary processingQueuequeue.DeleteMessage( msg );AJAX orthogonal concernWorker Role not related to HTML 5 concept of Web Worker35QCW requires IdempotentPerform idempotent operation more than once, end result same as if we did it onceExample with Thumbnailing (easy case)App-specific concerns dictate approachesCompensating action, Last write wins, etc.PARTNERSHIP: division of responsibility between cloud platform &amp; app Transaction cannot span database + queueQCW expects Poison MessagesA Poison Message cannot be processedError condition for non-transient reasonCheck CloudQueueMessage.DequeueCount propertyFalling off the queue may kill your systemDetermine a Max Retry policy per queueDelete, put on bad queue, alert human, QCW requires Plan for FailureVM restarts will happenHardware failure, O/S patching, crash (bug)Bake in handling of restarts into our appsRestarts are routine: system just keeps workingIdempotent mindset is keyEvent Sourcing (commonly seen with CQRS) may helpNot an exception case! Expect it!Consider N+1 RuleWindows Azure: Fabric Controller honors Fault Domains </p> <p>38Aside: Is QCW same as CQRS?Short answer: noCQRSCommand Query Responsibility SegregationCommands change stateQueries ask for current stateAny operation is one or the otherSometimes includes Event SourcingSometimes modeled using Domain Driven Design (DDD)What about the Data?You: Azure Web Roles and Azure Worker RolesTaking user input, dispatching work, doing workFollow a decoupled queue-in-the-middle patternStateless compute nodesCloud: Hard Part: persistent, scalable dataAzure Queue &amp; Blob ServicesThree copies of each byteBlobs are geo-replicatedBusy Signal Pattern</p> <p>Database Sharding Patternpattern 3 of 5Extend example into Data TierWhat happens when demands on data tier outgrow one physical database?STATEFUL need different approach42 Web Tier Web Tierpageofphotos.comScale data tier (shard)</p> <p>Sharding is horizontal scaling for databases.</p> <p>Unlike compute nodes, databases are not stateless.</p> <p>Database</p> <p>Service TierService TierDatabase/mauraDatabaseDatabaseCost-efficiency dont rent hotel rooms when you dont need them</p> <p>Operational efficiency manage many more servers w/o needing much more time</p> <p>43Database ShardingProblem: too much for one physical databaseToo much data (e.g., 150 GB limit in WASD)Not sufficiently performantSolution: split data across multiple databasesOne Logical Database, multiple Physical DatabasesEach Physical Database Node is a ShardGoal is a Shared Nothing design &amp; single shard handles most common business operationsMay require some denormalization (duplication)</p> <p>[Not same as Data Warehouse or Reporting DB]</p> <p>44</p> <p>All shards have same schemaSHARDSneed SOMETHING to shard --- like CustomerId45Sharding is DifficultWhat defines a shard? (Where to put/find stuff?)Example by HOME STATE: customer_ma, customer_ia, customer_co, customer_ri, Design to avoid query / join / transact across shardsWhat happens if a shard gets too big?Rebalancing shards can get complexFoursquare case study is interestingCache coherence, connection pool managementRolling-your-own is complex</p> <p>46Where does Windows Azure fit?Windows Azure SQL Database (WASD)is SQL Server with a few diffsCommonSQL ServerSpecific(for now)WASDSpecificJust change the connection stringFull Text SearchTransparent Data Encryption (TDE)Many more</p> <p>Limitations150 GB size limitBusy Signal PatternExtra CapabilitiesManaged ServiceHighly AvailableRental modelFederations information on Differences:</p> <p>Another feature in development is the ability to take control of your backups. Currently, backups are performed in the data centers to protect your data against disk or system problems. However, there is no way currently to control your own backups to provide protection against logical errors and use a RESTORE operation to return to an earlier point in time when a backup was made. The new feature involves the ability to make your own backups of your SQL Azure databases to your own on-premises storage, and the ability to restore those backups either to an on-premises database or to a SQL Azure database. Eventually Microsoft plans to provide the ability to perform SQL Azure backups across data centers and also make log backups so that point-in-time recovery can be implemented.</p> <p>Windows Azure SQL Databse Federations for ShardingSingle master databaseQuery Fanout makes partitions transparentInstead of customer_ma, customer_ia, etc we ar...</p>


View more >