Programming Microsoft Azure Service Fabric

 Programming Microsoft Azure Service Fabric Second Edition

Haishi Bai

PROGRAMMING MICROSOFT AZURE SERVICE FABRIC (Second edition) Published with the authorization of Microsoft Corporation by: Pearson Education, Inc. Copyright ? 2018 by Pearson Education, Inc.

All rights reserved. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, request forms, and the appropriate contacts within the Pearson Education Global Rights & Permissions Department, please visit permissions/. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein.

ISBN-13: 978-1-5093-0709-8 ISBN-10: 1-5093-0709-5

Library of Congress Control Number: 2018939252

1 18

TRADEMARKS Microsoft and the trademarks listed at on the "Trademarks" webpage are trademarks of the Microsoft group of companies. All other marks are property of their respective owners.

WARNING AND DISCLAIMER Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an "as is" basis. The author(s), the publisher, and Microsoft Corporation shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the CD or programs accompanying it.

SPECIAL SALES For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at corpsales@ or (800) 382-3419.

For government sales inquiries, please contact governmentsales@.

For questions about sales outside the U.S., please contact intlcs@.

Editor-in-Chief: Greg Wiegand Executive Editor: Laura Norman Development Editor: Kate Shoup/ Polymath Publishing Managing Editor: Sandra Schroeder Senior Project Editor: Tracey Croom/ Danielle Foster Copy Editor: Dan Foster Indexer: Valerie Haynes Perry Proofreader: Scout Festa Editorial Assistant: Cindy Teeters Cover Designer: Twist Creative, Seattle Compositor: Danielle Foster Graphics: Vived Graphics

To the entire Microsoft Service Fabric team, who made such a great product.

--Haishi Bai

Contents at a Glance

Introduction

xxiii

PART I

FUNDAMENTALS

CHAPTER 1

Hello, Service Fabric!

3

CHAPTER 2 Stateless Services

27

CHAPTER 3 Stateful Services

49

CHAPTER 4 Actor Pattern

67

CHAPTER 5 Service Deployments and Upgrades

91

CHAPTER 6 Availability and Reliability

117

CHAPTER 7 Scalability and Performance

145

PART II

SERVICE LIFE CYCLE MANAGEMENT

CHAPTER 8 Service Fabric Scripting

173

CHAPTER 9 Cluster Management

199

CHAPTER 10 Diagnostics and Monitoring

213

CHAPTER 11 Continuous Delivery

239

PART III

LINUX AND CONTAINERS

CHAPTER 12 Service Fabric on Linux

265

CHAPTER 13 Containers

279

CHAPTER 14 Container Orchestration

299

PART IV

WORKLOADS AND DESIGN PATTERNS

CHAPTER 15 Scalable Web

325

CHAPTER 16 Scalable Interactive Systems

343

CHAPTER 17 System Integration

367

PART V

ADVANCED TOPICS

CHAPTER 18 Serverless Computing

393

CHAPTER 19 Artificial Intelligence

409

CHAPTER 20 Orchestrating an Organic Compute Plane

437

PART VI

APPENDICES

Appendix A: Using Microsoft Azure

PowerShell Commands

473

Appendix B: Pattern Index

479

Index

483

vi

Contents at a Glance

Contents

About the Author. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Foreword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii

PART I

FUNDAMENTALS

Chapter 1 Hello, Service Fabric!

3

Microservices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Containerization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Scheduling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 State Reconciliation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Data Replication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Service Partitioning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Service Fabric Concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Nodes and Clusters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Applications and Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Partitions and Replicas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Programming Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Stateless vs. Stateful . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Guest Applications and Containers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Setting Up a Development Environment in Windows. . . . . . . . . . . . . . 10 Provisioning a Service Fabric Cluster on Azure. . . . . . . . . . . . . . . . . . . . . 11

Hello, World!. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Managing Your Local Cluster. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Visual Studio Cloud Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Service Fabric Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Windows PowerShell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Service Fabric CLI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Additional Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

vii

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download