0%

Book Description

Distributed systems have become more fine-grained as organizations shift from code-heavy monolithic applications to smaller, self-contained microservices. But developing these systems brings its own set of problems. With lots of examples and practical advice, this expanded second edition takes a holistic view of the topics system architects and administrators must consider when building, managing, and evolving microservices architectures.

Author Sam Newman provides you with a firm grounding in the concepts while diving into the latest solutions for modeling, integrating, testing, deploying, and monitoring your own autonomous services. Through real-world examples, you’ll learn how organizations worldwide are getting the most out of these architectures. Microservices technologies are moving quickly. This book brings you up to speed.

  • Get new information on user interfaces, container orchestration, and serverless
  • Use microservices to align system design with your organization’s goals
  • Explore options for integrating a service with the rest of your system
  • Take an incremental approach when splitting monolithic codebases
  • Deploy individual microservices through continuous integration
  • Examine the complexities of testing and monitoring distributed services
  • Manage security with expanded content around user-to-service and service-to-service models
  • Understand the challenges of scaling microservices architectures

Table of Contents

  1. 1. What Are Microservices?
    1. Microservices at a Glance
    2. Key Concepts of Microservices
      1. Independently Deployability
      2. Modelled Around a Business Domain
      3. Owning Their Own State
      4. Size
      5. Flexibility
      6. Alignment of Architecture and Organization
    3. The Monolith
      1. The Single-Process Monolith
      2. The Modular Monolith
      3. The Distributed Monolith
      4. Monoliths and Delivery Contention
      5. Advantages of Monoliths
    4. Enabling Technology
      1. Log Aggregation and Distributed Tracing
      2. Containers and Kubernetes
      3. Streaming
      4. Public Cloud and Serverless
    5. Advantages of Microservices
      1. Technology Heterogeneity
      2. Robustness
      3. Scaling
      4. Ease of Deployment
      5. Organizational Alignment
      6. Composability
    6. Microservice Pain Points
      1. Developer Experience
      2. Technology Overload
      3. Reporting
      4. Monitoring and Troubleshooting
      5. Security
      6. Testing
      7. Latency
      8. Data Consistency
    7. Should I Use Microservices?
      1. Who They Might Not Work For
      2. Where They Work Well
    8. Summary
  2. 2. How to Model Microservices
    1. Introducing MusicCorp
    2. What Makes a Good Microservice Boundary?
      1. Information Hiding
      2. Cohesion
      3. Coupling
      4. The Interplay of Coupling And Cohesion
    3. Types Of Coupling
      1. Domain Coupling
      2. Pass Though Coupling
      3. Common Coupling
      4. Content Coupling
    4. Alternatives to Domain-Oriented Decomposition
      1. Volatility
      2. Data
      3. Technology
      4. Organizational
    5. Different Goals, Different Drivers
      1. Mixing Models And Exceptions
    6. Just Enough Domain-Driven Design
      1. Ubiquitous Language
      2. Aggregate
      3. Bounded Context
      4. Mapping Aggregates and Bounded Contexts to Microservices
      5. Turtles All the Way Down
      6. The Dangers Of Premature Decomposition
      7. Communication in Terms of Business Concepts
    7. Event-storming
      1. Logistics
      2. The Process
    8. Summary
  3. 3. Microservice Communication Styles
    1. From In-Process To Inter-Process
      1. Performance
      2. Changing Interfaces
      3. Error handling
    2. Technology for Inter-process Communication: So Many Choices
    3. Styles of Microservice Communication
    4. Pattern: Synchronous Blocking
      1. Advantages
      2. Disadvantages
      3. Where To Use It
    5. Pattern: Asynchronous Non-blocking
      1. Advantages
      2. Disadvantages
      3. Where To Use It
    6. Pattern: Communication Through Common Data
      1. Implementation
      2. Advantages
      3. Disadvantages
      4. Where To Use It
    7. Pattern: Request-Response Communication
      1. Implementation: Synchronous vs Asynchronous
      2. Where To Use It
    8. Pattern: Event-Driven Communication
      1. Implementation
      2. What’s In An Event?
      3. Did It Work?
    9. Summary
  4. 4. Implementing Microservice Communication
    1. Make Backwards Compatibility Easy
    2. Make Your Interface Explicit
    3. Keep Your APIs Technology-Agnostic
    4. Make Your Service Simple for Consumers
    5. Hide Internal Implementation Detail
    6. Remote Procedure Calls
      1. Challenges
      2. Where To Use It
    7. REST
      1. REST and HTTP
      2. Hypermedia As the Engine of Application State
      3. Challenges
      4. Where To Use It
    8. GraphQL
      1. Challenges
      2. Where To Use It
    9. Message Brokers
      1. Topics and Queues
      2. Guaranteed Delivery
      3. Trust
      4. Other Characteristics
      5. Choices
      6. Kafka
    10. Serialization Formats
    11. Textual Formats
    12. Binary Formats
    13. Schemas
    14. Structural vs Semantic Contract Breakages
    15. Should You Use Schemas?
    16. Handling Change Between Microservices
    17. Avoiding Breaking Changes
      1. Expansion Changes
      2. Tolerant Reader
      3. Right Technology
      4. Explicit Interface
      5. Catch Accidental Breaking Changes Early
    18. Managing Breaking Changes
      1. Lock-Step Deployment
      2. Coexist Incompatible Microservice Versions
      3. Emulate The Old Interface
      4. Which Approach Do I Prefer?
      5. The Social Contract
      6. Tracking Usage
      7. Extreme Measures
    19. DRY and the Perils of Code Reuse in a Microservice World
      1. Sharing Code Via Libraries
    20. Summary
  5. 5. Build
    1. A Brief Introduction to Continuous Integration
      1. Are You Really Doing CI?
      2. Branching Models
    2. Build Pipelines and Continuous Delivery
      1. Tooling
      2. Tradeoffs and Environments
      3. Artifact Creation
    3. Mapping Source Code and Builds to Microservices
      1. One Giant Repo, One Giant Build
      2. Pattern: One Repository Per Microservice (aka Multi-Repo)
      3. Pattern: Monorepo
      4. Which Approach Would I Use?
    4. Summary
  6. 6. Deployment
    1. From Logical to Physical
      1. Multiple Instances
      2. The Database
      3. Environments
    2. Principles Of Microservice Deployment
      1. Isolated Execution
      2. Focus On Automation
      3. Infrastructure As Code
      4. Zero-downtime Deployment
      5. Desired State Management
    3. Deployment Options
      1. Physical Machines
      2. Virtual Machines
      3. Containers
      4. Application Containers
      5. Platform As A Service (PAAS)
      6. Function As A Service (FAAS)
    4. Which Deployment Option Is Right For You?
    5. Kubernetes & Container Orchestration
      1. The Case For Container Orchestration
      2. A Simplified View Of Kubernetes Concepts
      3. Multi-Tenancy and Federation
      4. The Cloud Native Computing Federation
      5. Platforms and Portability
      6. Helm, Operations and CRDs, oh my!
      7. And Knative
      8. The Future
      9. Should You Use It?
    6. Progressive Delivery
      1. Separating Deployment From Release
      2. On To Progressive Delivery
      3. Feature Toggles
      4. Canary Release
      5. Parallel Run
    7. Summary
3.146.105.194