You are previewing Programming Microsoft Azure Service Fabric.
O'Reilly logo
Programming Microsoft Azure Service Fabric

Book Description

Build exceptionally scalable cloud applications for fast-growing businesses

Microsoft Azure Service Fabric makes it easier than ever before to build large-scale distributed cloud applications. You can quickly develop and update microservice-based applications, efficiently operate highly reliable hyperscale services, and deploy the same application code on public, hosted, or private clouds. This book introduces all key Azure Service Fabric concepts and walks you through implementing several real-world applications. You’ll find advanced design patterns, tuning tips, and lessons learned from early adopters—all from the perspective of developing and operating large projects in production.

Microsoft Azure evangelist Haishi Bai shows how to:

  • Implement background services and use stateless services to handle user requests

  • Solve state-management problems in distributed systems

  • Package, stage, and deploy applications

  • Upgrade applications in place, with zero downtime

  • Leverage Quality of Service (QoS) options throughout app design, implementation, and operation

  • Manage Service Fabric clusters with Windows PowerShell and the Management Portal

  • Configure Service Fabric Diagnostics and analyze collected data

  • Test functionality and performance

  • Design Internet of Things (IoT) solutions that capture and manage petabytes of data

  • Handle demanding real-time data-streaming compute scenarios

  • Understand multitenancy and single-tenancy as logical architecture choices

  • Build Service Fabric game engines to support large-scale, multiplayer online games

  • Model complex systems with the Service Fabric Actors Pattern

  • About This Book

    For all cloud developers who want to create and operate large-scale distributed cloud applications by using Microsoft Azure Service Fabric

    For all IT professionals who want to integrate Windows Server and Microsoft Azure in any environment, including datacenters

    Table of Contents

    1. Cover
    2. Title Page
    3. Copyright Page
    4. Contents at a glance
    5. Table of contents
    6. Introduction
      1. Who should read this book
        1. Assumptions
        2. This book might not be for you if...
      2. Organization of this book
        1. Finding your best starting point in this book
      3. System requirements
      4. Downloads: Code samples
        1. Using the code samples
      5. Acknowledgments
      6. Free ebooks from Microsoft Press
      7. Quick access to online references
      8. Errata, updates, & book support
      9. We want to hear from you
      10. Stay in touch
    7. Part I: Fundamentals
      1. Chapter 1. Hello, Service Fabric!
        1. A modern PaaS
          1. Designed for agility
          2. Designed for QoS
          3. Separation of workload and infrastructure
        2. Service Fabric concepts
          1. Architecture
          2. Nodes and clusters
          3. Applications and services
          4. Partitions and replicas
          5. Programming modes
          6. Stateless vs. stateful
        3. Getting started
          1. Setting up a development environment
          2. Provisioning a Service Fabric cluster on Azure
        4. Hello, World
        5. Managing your local cluster
          1. Visual Studio Server Explorer
          2. Visual Studio Cloud Explorer
          3. Service Fabric Explorer
          4. Windows PowerShell
        6. Additional information
      2. Chapter 2. Stateless services
        1. Implement ASP.NET 5 applications
        2. Scalability and availability of a stateless service
          1. Availability
          2. Scalability
        3. Implement communication stacks
          1. Default communication stack
          2. WCF communication stack
          3. Custom communication stack
        4. Additional information
      3. Chapter 3. Stateful services
        1. Service Fabric state management
        2. Architecture of stateful services
          1. Reliable collections
          2. Reliable State Manager
          3. Transactional Replicator
          4. Logger
          5. Consistency
        3. The Simple Store application
          1. The shopping cart service
          2. The Simple Store client
          3. Service partition
          4. UniformInt64Partition
          5. NamedPartition
        4. Partitions and replicas
          1. Replica roles
          2. Scaling
        5. Additional information
      4. Chapter 4. Actor pattern
        1. Service Fabric Reliable Actors
          1. Actors
          2. Actor lifetime
          3. Actor states
          4. Actor communications
          5. Concurrency
        2. An actor-based tic-tac-toe game
          1. Actor models
          2. Create the application
          3. Define actor interfaces
          4. Implement the Game actor
          5. Implement the Player actor
          6. Implement the test client
          7. Test it
          8. Additional thoughts
        3. Timers, reminders, and events
          1. Actor timers
          2. Actor reminders
          3. Actor events
        4. Actor internals
          1. Actor diagnostics and performance monitoring
          2. Actors and Reliable Services
          3. Actor state providers
        5. Additional information
      5. Chapter 5. Service deployments and upgrades
        1. Service Fabric application deployment process
          1. Package
          2. Upload
          3. Register/provision
          4. Create/replace/upgrade
        2. Health model
          1. Health entities
          2. Health states
          3. Health policy
          4. Health reporting and aggregation
        3. Rolling upgrade
          1. Fault domains and update domains
          2. Upgrade process
          3. Upgrade modes and upgrade parameters
        4. Multiple environments
          1. Application parameters and parameter files
          2. Application publish profiles
        5. Using implicit hosts
          1. Defining implicit hosts
          2. RunAs policies
          3. Hosting a Node.js application
      6. Chapter 6. Availability and reliability
        1. Service availability and reliability
          1. A broken service
          2. Improving availability
          3. Improving reliability
        2. Service Fabric services availability
          1. Service placements
          2. Service failovers
          3. Routing and load balancing
          4. Advanced rolling upgrades
        3. Service Fabric services reliability
          1. Event Tracing for Windows
          2. Azure Diagnostics
          3. Chaos tests
          4. Service state backup and restore
      7. Chapter 7. Scalability and performance
        1. Scalability concepts
          1. Vertical scaling vs. horizontal scaling
          2. Scaling stateless services vs. scaling stateful services
          3. Homogeneous instances vs. heterogeneous instances
          4. Single-tenancy vs. multitenancy
          5. Manual scaling vs. autoscaling
        2. Scaling a Service Fabric cluster
          1. Manually scaling a Service Fabric cluster
          2. Autoscaling a Service Fabric cluster
          3. Scaling with Content Delivery Network
        3. Resolving bottlenecks
          1. State bottlenecks
          2. Communication bottlenecks
          3. Orchestration bottlenecks
    8. Part II: Service lifecycle management
      1. Chapter 8. Managing Service Fabric with Windows PowerShell
        1. Creating a secured Service Fabric cluster
          1. Protecting your cluster by using a certificate
          2. Client authentication using a certificate
          3. Publishing applications from Visual Studio
        2. Cluster management commands
          1. Queries
          2. Node operations
          3. Additional cluster management commands
        3. Application management commands
          1. Deploying an application
          2. Upgrading an application
          3. Rolling back an application
          4. Decommissioning an application
        4. Additional information
      2. Chapter 9. Managing Service Fabric with management portal
        1. Anatomy of a Service Fabric cluster
          1. Availability set
          2. Virtual machines and NICs
          3. Virtual network
          4. Load balancer
          5. Storage accounts
        2. Advanced Service Fabric cluster configuration
          1. Role-Based Access Control
          2. Network Security Groups
        3. Additional information
      3. Chapter 10. Diagnostics and monitoring
        1. Diagnostics
          1. Configuring Service Fabric Diagnostics
          2. Using Elasticsearch and Kibana
          3. Azure Operations Management Suite
        2. Monitoring
          1. Service Fabric Explorer
          2. Visual Studio Application Insights
        3. Additional information
      4. Chapter 11. Testing
        1. Software testability
          1. Controllability
          2. Observability
          3. Isolateability
          4. Clarity
        2. Writing basic test cases
        3. Setting up continuous integration
          1. Preparing the Visual Studio Team Services project
          2. Preparing the build machine
          3. Creating a build definition
          4. Running tests upon code check-ins
          5. Running load tests with VSTS
        4. Testability subsystem
          1. Testability actions
          2. Invoking testability actions using PowerShell
        5. Additional information
    9. Part III: Patterns and scenarios
      1. Chapter 12. Web applications
        1. Azure PaaS ecosystem
          1. App Services
          2. Cloud Services
          3. Service Fabric
          4. Choosing PaaS platforms
          5. Azure Services for your web applications
        2. Scenarios and patterns
          1. E-commerce websites
          2. Mass-source websites
          3. Enterprise portals
        3. Additional information
      2. Chapter 13. Internet of Things
        1. Azure IoT solutions
          1. Data generation and feedback
          2. Command and control
          3. Data ingress
          4. Data transformation and analysis
          5. Storage
          6. Presentation and actions
        2. Scenarios and patterns
          1. Remote monitoring
          2. Other scenarios
        3. Additional information
      3. Chapter 14. Real-time data streaming
        1. Real-time data streaming on Azure
          1. Five Vs of big data
          2. Azure Stream Analytics
          3. Big data storages
        2. Scenarios and patterns
          1. A big data solution
          2. Responsive website with live data stream processing
        3. Additional information
      4. Chapter 15. Multitenancy and hosting
        1. Multitenancy on Azure
          1. Multitenancy vs. single tenancy
          2. Azure multitenant support
        2. Building multitenant systems with Service Fabric
          1. Pattern: Tenant Manager
          2. Pattern: Cross-tenant aggregation
          3. Pattern: Self-service
          4. Tenant by partitions
          5. Pattern: Metadata-driven system
        3. Hosting multitenant systems
          1. Hosting service processes
          2. Pattern: Throttling Actor
      5. Chapter 16. Multiplayer gaming
        1. Messy Chess
          1. Chessboard and game goal
          2. Challenges
          3. Game board
          4. Game pieces
          5. Players
          6. Game hosting
        2. A.I. Quests
          1. Game world
          2. Player interactions
    10. Part IV: Advanced topics
      1. Chapter 17. Advanced service hosting
        1. A canonical PaaS platform
          1. Application package format
          2. Resource orchestration
          3. Application gallery
        2. Hosting guest applications
          1. High availability
          2. Health monitoring
          3. Application lifecycle management
          4. Density
          5. Hosting a simple guest application
        3. Container integration
          1. History of containers
          2. Service Fabric and containers
          3. Container types
        4. Deploy anywhere
          1. Deploy stand-alone clusters
          2. Deploy on Azure Stack
          3. Deploy on Amazon Web Services (AWS)
          4. Service Fabric standalone package
      2. Chapter 18. Modeling complex systems
        1. Adaptive complex systems
          1. Complex systems and complicated systems
          2. Emergence
          3. A simple model
          4. Modeling and computational modeling
        2. The termite model
          1. Set up the solution
          2. Implement the Box service
          3. Implement the termite actor
          4. Implement the test client
          5. Test and analysis
        3. Service Fabric for complex systems
          1. Distributed data structures
          2. Actor Swarms
        4. The spatial segregation model
          1. Set up the solution
          2. Implement shared array with proposal supports
          3. Implement the virtual actor
          4. Implement the Actor Swarm
          5. Implement the test client
          6. Test the model
        5. Future works
    11. Part V: Appendices
      1. Appendix A. Service Fabric subsystems and system services
        1. Reliability subsystem
          1. Failover Manager
          2. Resource Balancer
          3. Replicator
        2. Management subsystem
          1. Image store
          2. Health Manager
          3. Cluster Manager
        3. Hosting subsystem
        4. Communication subsystem
        5. Testability subsystem
        6. Transport subsystem
        7. Federation subsystem
        8. System services
      2. Appendix B. Using Microsoft Azure PowerShell commands
        1. Installation
        2. Sign in
        3. Discovering commands
        4. Managing Azure resource groups
          1. Basic resource group management
          2. Authoring an ARM template
          3. Deploying a resource group
          4. Deploying a Service Fabric cluster using an ARM template
      3. Appendix C. Microsoft and containers
        1. Docker engine on Azure virtual machines
          1. Use a pre-built image
          2. Use the Docker VM extension
          3. Use Azure CLI
          4. Use Docker Machine
        2. Docker Hub and Docker Trusted Registry
          1. Accessing images from Docker Hub from Azure management portal
          2. Provisioning a Docker Trusted Registry
        3. Container orchestration
          1. Third-party container orchestration on Azure
          2. Azure Container Service
        4. Windows containers
      4. Appendix D. Pattern index
        1. Distributed computing
        2. Multitenancy
        3. Gaming and simulations
        4. Performance and scalability
        5. Reliability
        6. System architecture
    12. Index
    13. About the author
    14. Visit us today
    15. Hear about it first
    16. Free ebooks
    17. Survey
    18. Code Snippets