Cloud Application Architecture Guide

Transcription

CloudApplicationArchitectureGuide

PUBLISHED BYMicrosoft PressA division of Microsoft CorporationOne Microsoft WayRedmond, Washington 98052-6399Copyright 2017 by Microsoft CorporationAll rights reserved. No part of the contents of this book may be reproduced or transmitted in anyform or by any means without the written permission of the publisher.Microsoft Press books are available through booksellers and distributors worldwide. If you needsupport related to this book, email Microsoft Press Support at mspinput@microsoft.com. Please tellus what you think of this book at http://aka.ms/tellpress.This book is provided “as-is” and expresses the author’s views and opinions. The views, opinions andinformation expressed in this book, including URL and other Internet website references, may changewithout notice.Some examples depicted herein are provided for illustration only and are fictitious. No realassociation or connection is intended or should be inferred.Microsoft and the trademarks listed at http://www.microsoft.com on the “Trademarks” webpage aretrademarks of the Microsoft group of companies. All other marks are property of their respectiveowners.Acquisitions Editor:Christopher BennageDevelopmental Editors:Mike Wasson, Masashi Narumoto and the Microsoft Patterns and Practices teamEditorial Production:Phil EvansCopyeditor:Jamie Letaini

ContentsOverview . . . . . viiIntroduction . viiiChapter 1: Choose an architecture style . . . . 1A quick tour of the styles . 2Architecture styles as constraints . 4Consider challenges and benefits . 5Chapter 1a: N-tier architecture style . . 6When to use this architecture . 7Benefits . 7Challenges . 7Best practices . 8N-tier architecture on virtual machines . 8Additional considerations . 9Chapter 1b: Web-Queue-Worker architecture style . 10When to use this architecture . 11Benefits . 11Challenges . 11Best practices . 11Web-Queue-Worker on Azure App Service . 12Additional considerations . 12Chapter 1c: Microservices architecture style . 14When to use this architecture . 15Benefits . 15Challenges . 16Best practices . 17Microservices using Azure Container Service . 19Chapter 1d: CQRS architecture style . . . 20When to use this architecture . 21Benefits . 21Challenges . 22Best practices . 22CQRS in microservices . 22iiContents

Chapter 1e: Event-driven architecture style . . . . 24When to use this architecture . 25Benefits . 25Challenges . 25IoT architectures . 26Chapter 1f: Big data architecture style . 27Benefits . 29Challenges . 29Best practices . 30Chapter 1g: Big compute architecture style . 31When to use this architecture . 32Benefits . 32Challenges . 32Big compute using Azure Batch . 33Big compute running on Virtual Machines . 33Chapter 2: Choose compute and data store technologies . . 35Chapter 2a: Overview of compute options . . . 37Chapter 2b: Compute comparison . . . 39Hosting model . 39DevOps . 40Scalability . 41Availability . 41Security . 42Other . 42Chapter 2c: Data store overview . . 43Relational database management systems . 44Key/value stores . 44Document databases . 45Graph databases . 46Column-family databases . 47Data analytics . 48Search Engine Databases . 48Time Series Databases . 48Object storage . 49Shared files . 49Chapter 2d: Data store comparison . . 50Criteria for choosing a data store . 50General Considerations . 50Relational database management systems (RDBMS) . 52Document databases . 53Key/value stores . 54iiiContents

Graph databases . 55Column-family databases . 56Search engine databases . 57Data warehouse . 57Time series databases . 58Object storage . 58Shared files . 59Chapter 3: Design your Azure application: design principles . 60Chapter 3a: Design for self healing . . 62Recommendations . 62Chapter 3b: Make all things redundant . . 64Recommendations . 64Chapter 3c: Minimize coordination . . . 66Recommendations . 67Chapter 3d: Design to scale out . . . 69Recommendations . 69Chapter 3e: Partition around limits . . . 71Recommendations . 72Chapter 3f: Design for operations . . . 73Recommendations . 73Chapter 3g: Use managed services . . . 75Chapter 3h: Use the best data store for the job . . 76Recommendations . 77Chapter 3i: Design for evolution . . 78Recommendations . 78Chapter 3j: Build for the needs of business . . 80Recommendations . 80Chapter 3k: Designing resilient applications for Azure . . 82What is resiliency? . 82Process to achieve resiliency . 83Defining your resiliency requirements . 83Designing for resiliency. 87Resiliency strategies . 87Resilient deployment . 91Monitoring and diagnostics . 92Manual failure responses . 93Summary . 94Chapter 4: Design your Azure application: Use these pillars of quality . . 95Scalability . 96Availability . 98Resiliency . 99ivContents

Management and DevOps . 100Security . 101Chapter 5: Design your Azure application: Design patterns . . 103Challenges in cloud development . 103Data Management . 104Design and Implementation . 104Messaging . 105Management and Monitoring . 106Performance and Scalability . 107Resiliency . 108Security . 109Chapter 6: Catalog of patterns . . . 110Ambassador pattern . 110Anti-Corruption Layer pattern . 112Backends for Frontends pattern . 114Bulkhead pattern . 116Cache-Aside pattern . 119Circuit Breaker pattern . 124CQRS pattern . 132Compensating Transaction pattern . 139Competing Consumers pattern . 143Compute Resource Consolidation pattern . 148Event Sourcing pattern . 156External Configuration Store pattern . 162Federated Identity pattern . 170Gatekeeper pattern . 174Gateway Aggregation pattern . 176Gateway Offloading pattern . 180Gateway Routing pattern . 182Health Endpoint Monitoring pattern . 185Index Table pattern . 191Leader Election pattern . 197Materialized View pattern . 204Pipes and Filters pattern . 208Priority Queue pattern . 215Queue-Based Load Leveling pattern . 221Retry pattern . 224Scheduler Agent Supervisor pattern . 227Sharding pattern . 234Sidecar pattern . 243vContents

Static Content Hosting pattern . 246Strangler pattern . 250Throttling pattern . 252Valet Key pattern . 256Chapter 7: Design review checklists . . . 263DevOps checklist . 264Availability checklist . 270Scalability checklist . 276Resiliency checklist . 276Azure services . 286Chapter 8: Summary. . 291Chapter 9: Azure reference architectures . . 292Identity management . . 293Hybrid network . . 298Network DMZ . . 303Managed web application . . 306Running Linux VM workloads . . 310Running Windows VM workloads . . 315viContents

Cloud ApplicationArchitectureGuideThis guide presents a structured approach for designing cloudapplications that are scalable, resilient, and highly available. The guidancein this ebook is intended to help your architectural decisions regardlessof your cloud platform, though we will be using Azure so we can sharethe best practices that we have learned from many years of customerengagements.In the following chapters, we will guide you through a selection of importantconsiderations and resources to help determine the best approach for yourcloud application:1. Choosing the right architecture style for your application based on the kind ofsolution you are building.2. Choosing the most appropriate compute and data store technologies.3. Incorporating the ten high-level design principles to ensure your applicationis scalable, resilient, and manageable.4. Utilizing the five pillars of software q

system. The Cloud Application Architecture Guide is designed to help you navigate these changes. The Cloud Application Architecture Guide is organized as a series of steps, from the architecture and design to implementation. For each step, there is supporting guidance that will help you with the