Designing Distributed Systems

Book description

Without established design patterns to guide them, developers have had to build distributed systems from scratch, and most of these systems are very unique indeed. Today, the increasing use of containers has paved the way for core distributed system patterns and reusable containerized components. This practical guide presents a collection of repeatable, generic patterns to help make the development of reliable distributed systems far more approachable and efficient.

Author Brendan Burns—Director of Engineering at Microsoft Azure—demonstrates how you can adapt existing software design patterns for designing and building reliable distributed applications. Systems engineers and application developers will learn how these long-established patterns provide a common language and framework for dramatically increasing the quality of your system.

  • Understand how patterns and reusable components enable the rapid development of reliable distributed systems
  • Use the side-car, adapter, and ambassador patterns to split your application into a group of containers on a single machine
  • Explore loosely coupled multi-node distributed patterns for replication, scaling, and communication between the components
  • Learn distributed system patterns for large-scale batch data processing covering work-queues, event-based processing, and coordinated workflows

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. Who Should Read This Book
    2. Why I Wrote This Book
    3. The World of Distributed Systems Today
    4. Navigating This Book
    5. Conventions Used in This Book
    6. Online Resources
    7. Using Code Examples
    8. O’Reilly Safari
    9. How to Contact Us
    10. Acknowledgments
  2. 1. Introduction
    1. A Brief History of Systems Development
    2. A Brief History of Patterns in Software Development
      1. Formalization of Algorithmic Programming
      2. Patterns for Object-Oriented Programming
      3. The Rise of Open Source Software
    3. The Value of Patterns, Practices, and Components
      1. Standing on the Shoulders of Giants
      2. A Shared Language for Discussing Our Practice
      3. Shared Components for Easy Reuse
    4. Summary
  3. I. Single-Node Patterns
    1. Motivations
    2. Summary
  4. 2. The Sidecar Pattern
    1. An Example Sidecar: Adding HTTPS to a Legacy Service
    2. Dynamic Configuration with Sidecars
    3. Modular Application Containers
      1. Hands On: Deploying the topz Container
    4. Building a Simple PaaS with Sidecars
    5. Designing Sidecars for Modularity and Reusability
      1. Parameterized Containers
      2. Define Each Container’s API
      3. Documenting Your Containers
    6. Summary
  5. 3. Ambassadors
    1. Using an Ambassador to Shard a Service
      1. Hands On: Implementing a Sharded Redis
    2. Using an Ambassador for Service Brokering
    3. Using an Ambassador to Do Experimentation or Request Splitting
      1. Hands On: Implementing 10% Experiments
  6. 4. Adapters
    1. Monitoring
      1. Hands On: Using Prometheus for Monitoring
    2. Logging
      1. Hands On: Normalizing Different Logging Formats with Fluentd
    3. Adding a Health Monitor
      1. Hands On: Adding Rich Health Monitoring for MySQL
  7. II. Serving Patterns
    1. Introduction to Microservices
  8. 5. Replicated Load-Balanced Services
    1. Stateless Services
      1. Readiness Probes for Load Balancing
      2. Hands On: Creating a Replicated Service in Kubernetes
    2. Session Tracked Services
    3. Application-Layer Replicated Services
    4. Introducing a Caching Layer
      1. Deploying Your Cache
      2. Hands On: Deploying the Caching Layer
    5. Expanding the Caching Layer
      1. Rate Limiting and Denial-of-Service Defense
      2. SSL Termination
      3. Hands On: Deploying nginx and SSL Termination
    6. Summary
  9. 6. Sharded Services
    1. Sharded Caching
      1. Why You Might Need a Sharded Cache
      2. The Role of the Cache in System Performance
      3. Replicated, Sharded Caches
      4. Hands On: Deploying an Ambassador and Memcache for a Sharded Cache
    2. An Examination of Sharding Functions
      1. Selecting a Key
      2. Consistent Hashing Functions
      3. Hands On: Building a Consistent HTTP Sharding Proxy
    3. Sharded, Replicated Serving
    4. Hot Sharding Systems
  10. 7. Scatter/Gather
    1. Scatter/Gather with Root Distribution
      1. Hands On: Distributed Document Search
    2. Scatter/Gather with Leaf Sharding
      1. Hands On: Sharded Document Search
      2. Choosing the Right Number of Leaves
    3. Scaling Scatter/Gather for Reliability and Scale
  11. 8. Functions and Event-Driven Processing
    1. Determining When FaaS Makes Sense
      1. The Benefits of FaaS
      2. The Challenges of FaaS
      3. The Need for Background Processing
      4. The Need to Hold Data in Memory
      5. The Costs of Sustained Request-Based Processing
    2. Patterns for FaaS
      1. The Decorator Pattern: Request or Response Transformation
      2. Hands On: Adding Request Defaulting Prior to Request Processing
      3. Handling Events
      4. Hands On: Implementing Two-Factor Authentication
      5. Event-Based Pipelines
      6. Hands On: Implementing a Pipeline for New-User Signup
  12. 9. Ownership Election
    1. Determining If You Even Need Master Election
    2. The Basics of Master Election
      1. Hands On: Deploying etcd
      2. Implementing Locks
      3. Hands On: Implementing Locks in etcd
      4. Implementing Ownership
      5. Hands On: Implementing Leases in etcd
    3. Handling Concurrent Data Manipulation
  13. III. Batch Computational Patterns
  14. 10. Work Queue Systems
    1. A Generic Work Queue System
      1. The Source Container Interface
      2. The Worker Container Interface
      3. The Shared Work Queue Infrastructure
    2. Hands On: Implementing a Video Thumbnailer
    3. Dynamic Scaling of the Workers
    4. The Multi-Worker Pattern
  15. 11. Event-Driven Batch Processing
    1. Patterns of Event-Driven Processing
      1. Copier
      2. Filter
      3. Splitter
      4. Sharder
      5. Merger
    2. Hands On: Building an Event-Driven Flow for New User Sign-Up
    3. Publisher/Subscriber Infrastructure
    4. Hands On: Deploying Kafka
  16. 12. Coordinated Batch Processing
    1. Join (or Barrier Synchronization)
    2. Reduce
      1. Hands On: Count
      2. Sum
      3. Histogram
    3. Hands On: An Image Tagging and Processing Pipeline
  17. 13. Conclusion: A New Beginning?
  18. Index

Product information

  • Title: Designing Distributed Systems
  • Author(s): Brendan Burns
  • Release date: February 2018
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781491983645