Monolith to Microservices

Book description

How do you detangle a monolithic system and migrate it to a microservice architecture? How do you do it while maintaining business-as-usual? As a companion to Sam Newman’s extremely popular Building Microservices, this new book details a proven method for transitioning an existing monolithic system to a microservice architecture.

With many illustrative examples, insightful migration patterns, and a bevy of practical advice to transition your monolith enterprise into a microservice operation, this practical guide covers multiple scenarios and strategies for a successful migration, from initial planning all the way through application and database decomposition. You’ll learn several tried and tested patterns and techniques that you can use as you migrate your existing architecture.

  • Ideal for organizations looking to transition to microservices, rather than rebuild
  • Helps companies determine whether to migrate, when to migrate, and where to begin
  • Addresses communication, integration, and the migration of legacy systems
  • Discusses multiple migration patterns and where they apply
  • Provides database migration examples, along with synchronization strategies
  • Explores application decomposition, including several architectural refactoring patterns
  • Delves into details of database decomposition, including the impact of breaking referential and transactional integrity, new failure modes, and more

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. What You Will Learn
    2. Conventions Used in This Book
    3. O’Reilly Online Learning
    4. How to Contact Us
    5. Acknowledgments
  2. 1. Just Enough Microservices
    1. What Are Microservices?
      1. Independent Deployability
      2. Modeled Around a Business Domain
      3. Own Their Own Data
      4. What Advantages Can Microservices Bring?
      5. What Problems Do They Create?
      6. User Interfaces
      7. Technology
      8. Size
      9. And Ownership
    2. The Monolith
      1. The Single Process Monolith
      2. The Distributed Monolith
      3. Third-Party Black-Box Systems
      4. Challenges of Monoliths
      5. Advantages of Monoliths
    3. On Coupling and Cohesion
      1. Cohesion
      2. Coupling
    4. Just Enough Domain-Driven Design
      1. Aggregate
      2. Bounded Context
      3. Mapping Aggregates and Bounded Contexts to Microservices
      4. Further Reading
    5. Summary
  3. 2. Planning a Migration
    1. Understanding the Goal
      1. Three Key Questions
    2. Why Might You Choose Microservices?
      1. Improve Team Autonomy
      2. Reduce Time to Market
      3. Scale Cost-Effectively for Load
      4. Improve Robustness
      5. Scale the Number of Developers
      6. Embrace New Technology
    3. When Might Microservices Be a Bad Idea?
      1. Unclear Domain
      2. Startups
      3. Customer-Installed and Managed Software
      4. Not Having a Good Reason!
    4. Trade-Offs
    5. Taking People on the Journey
    6. Changing Organizations
      1. Establishing a Sense of Urgency
      2. Creating the Guiding Coalition
      3. Developing a Vision and Strategy
      4. Communicating the Change Vision
      5. Empowering Employees for Broad-Based Action
      6. Generating Short-Term Wins
      7. Consolidating Gains and Producing More Change
      8. Anchoring New Approaches in the Culture
    7. Importance of Incremental Migration
      1. It’s Production That Counts
    8. Cost of Change
      1. Reversible and Irreversible Decisions
      2. Easier Places to Experiment
    9. So Where Do We Start?
    10. Domain-Driven Design
      1. How Far Do You Have to Go?
      2. Event Storming
      3. Using a Domain Model for Prioritization
    11. A Combined Model
    12. Reorganizing Teams
      1. Shifting Structures
      2. It’s Not One Size Fits All
      3. Making a Change
      4. Changing Skills
    13. How Will You Know if the Transition Is Working?
      1. Having Regular Checkpoints
      2. Quantitative Measures
      3. Qualitative Measures
      4. Avoiding the Sunk Cost Fallacy
      5. Being Open to New Approaches
    14. Summary
  4. 3. Splitting the Monolith
    1. To Change the Monolith, or Not?
      1. Cut, Copy, or Reimplement?
      2. Refactoring the Monolith
    2. Migration Patterns
    3. Pattern: Strangler Fig Application
      1. How It Works
      2. Where to Use It
      3. Example: HTTP Reverse Proxy
      4. Data?
      5. Proxy Options
      6. Changing Protocols
      7. Example: FTP
      8. Example: Message Interception
      9. Other Protocols
      10. Other Examples of the Strangler Fig Pattern
    4. Changing Behavior While Migrating Functionality
    5. Pattern: UI Composition
      1. Example: Page Composition
      2. Example: Widget Composition
      3. Example: Micro Frontends
      4. Where to Use It
    6. Pattern: Branch by Abstraction
      1. How It Works
      2. As a Fallback Mechanism
      3. Where to Use It
    7. Pattern: Parallel Run
      1. Example: Comparing Credit Derivative Pricing
      2. Example: Homegate Listings
      3. Verification Techniques
      4. Using Spies
      5. GitHub Scientist
      6. Dark Launching and Canary Releasing
      7. Where to Use It
    8. Pattern: Decorating Collaborator
      1. Example: Loyalty Program
      2. Where to Use It
    9. Pattern: Change Data Capture
      1. Example: Issuing Loyalty Cards
      2. Implementing Change Data Capture
      3. Where to Use It
    10. Summary
  5. 4. Decomposing the Database
    1. Pattern: The Shared Database
      1. Coping Patterns
      2. Where to Use It
    2. But It Can’t Be Done!
    3. Pattern: Database View
      1. The Database as a Public Contract
      2. Views to Present
      3. Limitations
      4. Ownership
      5. Where to Use It
    4. Pattern: Database Wrapping Service
      1. Where to Use It
    5. Pattern: Database-as-a-Service Interface
      1. Implementing a Mapping Engine
      2. Compared to Views
      3. Where to Use It
    6. Transferring Ownership
      1. Pattern: Aggregate Exposing Monolith
      2. Pattern: Change Data Ownership
    7. Data Synchronization
    8. Pattern: Synchronize Data in Application
      1. Step 1: Bulk Synchronize Data
      2. Step 2: Synchronize on Write, Read from Old Schema
      3. Step 3: Synchronize on Write, Read from New Schema
      4. Where to Use This Pattern
      5. Where to Use It
    9. Pattern: Tracer Write
      1. Data Synchronization
      2. Example: Orders at Square
      3. Where to Use It
    10. Splitting Apart the Database
      1. Physical Versus Logical Database Separation
    11. Splitting the Database First, or the Code?
      1. Split the Database First
      2. Split the Code First
      3. Split Database and Code Together
      4. So, Which Should I Split First?
    12. Schema Separation Examples
    13. Pattern: Split Table
      1. Where to Use It
    14. Pattern: Move Foreign-Key Relationship to Code
      1. Moving the Join
      2. Data Consistency
      3. Where to Use It
      4. Example: Shared Static Data
    15. Transactions
      1. ACID Transactions
      2. Still ACID, but Lacking Atomicity?
      3. Two-Phase Commits
      4. Distributed Transactions—Just Say No
    16. Sagas
      1. Saga Failure Modes
      2. Implementing Sagas
      3. Sagas Versus Distributed Transactions
    17. Summary
  6. 5. Growing Pains
    1. More Services, More Pain
    2. Ownership at Scale
      1. How Can This Problem Show Itself?
      2. When Might This Problem Occur?
      3. Potential Solutions
    3. Breaking Changes
      1. How Can This Problem Show Itself?
      2. When Might This Problem Occur?
      3. Potential Solutions
    4. Reporting
      1. When Might This Problem Occur?
      2. Potential Solutions
    5. Monitoring and Troubleshooting
      1. When Might These Problems Occur?
      2. How Can These Problems Occur?
      3. Potential Solutions
    6. Local Developer Experience
      1. How Can This Problem Show Itself?
      2. When Might This Occur?
      3. Potential Solutions
    7. Running Too Many Things
      1. How Might This Problem Show Itself?
      2. When Might This Problem Occur?
      3. Potential Solutions
    8. End-to-End Testing
      1. How Can This Problem Show Itself?
      2. When Might This Problem Occur?
      3. Potential Solutions
    9. Global Versus Local Optimization
      1. How Can This Problem Show Itself?
      2. When Might This Problem Occur?
      3. Potential Solutions
    10. Robustness and Resiliency
      1. How Can This Problem Show Itself?
      2. When Might This Problem Occur?
      3. Potential Solutions
    11. Orphaned Services
      1. How Can This Problem Show Itself?
      2. When Might This Problem Occur?
      3. Potential Solutions
    12. Summary
  7. 6. Closing Words
  8. A. Bibliography
  9. B. Pattern Index
  10. Index

Product information

  • Title: Monolith to Microservices
  • Author(s): Sam Newman
  • Release date: November 2019
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781492047841