Chapter 7: The Microservice architecture: enabling fast sustainable flow
The introduction explains when outgrowing a monolith can make migration to microservices sensible, then previews the chapter.
After this chapter you will be able to
- When migration becomes sensible. Explain why a successful business-critical application might need to move from a monolithic to a microservice architecture, despite a monolith often being a good choice.
- Ambiguity of microservice architecture. Explain why calling a system a microservice architecture requires more than noting that it has multiple services or focusing on service size, and why an unclear definition makes its trade-offs harder to assess.
- Microservice architecture definition. Describe the five concepts in the author's definition: an architectural style with two or more services, each a deployable component consisting of subdomains, whose services are loosely coupled and independently deployable.
- Fowler and Lewis definition. Describe how Fowler and Lewis define a microservice architecture, including how services are organized, communicate, and deployed.
- Shared Definition Concepts. Describe what the two definitions have in common: business-oriented services and independent deployability, with automated deployment and multiple technology stacks also compatible with the author’s definition.
- Service Size and Replaceability. Explain why the author does not make small service size or replaceability a goal of microservice architecture.
- Loose Coupling as Defining Characteristic. Explain the distinguishing emphasis the author places on loose coupling alongside independent deployability.
- Multidimensional microservice architecture. Explain why a service-focused definition is incomplete and identify system operations, build architecture, and the service-team relationship as other important aspects.
- Services and API Gateway. Describe the example application as three services—Order, Delivery, and Consumer—plus an API Gateway that routes external traffic to the services.
- Service structure and boundaries. Describe how a service contains one or more subdomains and exposes an API while keeping its database private. Explain that a subdomain may belong solely to one service or be a shared library used by multiple services.
- Service API operation roles. Distinguish service operations that implement system operations from operations used only for collaboration between services. Describe the API’s operations and events, including that operations may be invoked synchronously or asynchronously.
- Two kinds of system operations. Distinguish local operations, which one service handles entirely, from distributed operations, which span multiple services.
- Distributed operation entry point. Trace a distributed operation from the service that first handles the request to its collaboration with other services, and state how its implementation complexity usually compares with a local operation.
- Independent deployment requirement. Explain that a microservice build architecture can be structured in different ways, but it must support independently deployable services.
- Repository structure tradeoffs. Distinguish the multi-repo and monorepo options by how they organize service code and by their deployment, scaling, and global-change tradeoffs.
- Single-team service ownership. Explain why a service is ideally owned by one team and how loose design-time coupling lets that team develop, test, and deploy independently.
- Flexible service-team mapping. Describe why services and teams do not have to map one-to-one, including how subdomains owned by different teams can share a service and why network costs might justify that arrangement.
- Essential service characteristics. Explain why independent deployability and loose coupling are essential to a microservice architecture, and describe the risk when services lack them.
- Deployable unit and pipeline. Explain why a service must be both a deployable component and have its own pipeline that builds, tests, and deploys it; packaging alone is insufficient.
- Production readiness through isolated testing. Describe how a service can be production-ready after its own tests, including how those tests invoke its API and handle collaborators.
- Contracts for separate service tests. Explain how consumer-driven contract tests check service interactions without testing services together, and why maintaining those tests can be costly.
- Faster releases with less coordination. Justify why independent deployability improves pipeline speed and reliability and reduces coordination between teams, compared with testing services together.
- Loose design-time coupling. Explain why changes that must be coordinated across services impede fast flow, and describe how a breaking service API change can be rolled out without breaking clients.
- Modifiability through loose coupling. Explain how loose design-time coupling lets teams change their services independently, and why maintaining that coupling takes ongoing effort.
- Incremental technology stack evolution. Explain why a multi-component microservice architecture makes technology-stack upgrades easier to schedule and prioritize.
- Fast independent service testing. Describe how small, independently testable services and separate pipelines keep testing from becoming a bottleneck.
- Independent and reliable deployments. Explain how small, independently deployable services allow frequent, reliable production deployments without cross-team coordination.
- Fine-grained service telemetry. Explain how telemetry from individual service instances improves insight into application behavior compared with monolithic application-instance telemetry.
- Service-specific technology choices. Explain how a microservice architecture lets each service use a technology stack suited to its needs, and why the organization must still manage its approved technologies.
- Service ownership and pipelines. Describe how a microservice architecture lets an organization add teams while continuing to deliver features rapidly.
- Service Developer Experience. Explain why working on a service can improve the developer experience: developers can focus on their service’s business logic, handle a smaller code base, and get faster feedback from tests and deployment.
- Independent scaling by resource needs. Explain why subdomains with different resource and instance needs can be cheaper to run as separate services, using Order Management and Fraud Detection as an example.
- Availability by business criticality. Explain how separating business-critical functionality from less-critical functionality can protect its availability.
- Core subdomain development focus. Distinguish core, supporting, and generic subdomains, and explain why putting core subdomains in separate services can speed their development.
- Microservice architecture tradeoff. Explain why the microservice architecture’s strengths also come with drawbacks.
- Cross service operation boundaries. Explain why an operation spanning services is more complicated than a local operation, even when important operations are kept within one service.
- Service scoped transaction approach. Explain why one ACID transaction is unsuitable for an operation spanning loosely coupled services and describe the section’s preferred approach.
- Eventual consistency trade-offs. Describe the temporary inconsistency and availability benefit of a distributed command built from local transactions, along with its transaction-management costs.
- Local and cross-service trade-off. Explain why changes within one service can be faster than in a monolith, while changes spanning services can be harder, and why service boundaries should keep most changes local.
- Breaking API rollout sequence. Describe the non-breaking sequence used to roll out the example's breaking Consumer Service API change without causing a production outage.
- Consequences of service boundaries. Explain why placing subdomains used by the same system operation in separate services is more consequential than placing classes in different packages.
- Distributed monolith failure modes. Describe how tight coupling between services can produce a distributed monolith and why that makes design mistakes costly.
- Microservice operational complexity. Explain why deploying and operating microservices is challenging compared with operating a monolith, including the difficulty of troubleshooting emergent behavior.
- Application-Level Testing Friction. Explain why user acceptance tests that work for a monolith can prevent independent deployment in a microservice architecture, and why insisting on testing services together creates a distributed monolith.
- Service-Level Acceptance Tests. Describe how service-level acceptance tests replace application-level tests: they test each service in isolation while using knowledge of service collaboration to verify its behavior.
- Difficulty of monolith migration. Explain what makes migration from a monolith to microservices challenging and why organizations may undertake it anyway.
- Patterns in deliberative design. Explain why deliberative design is challenging for microservices and how patterns help: designers must understand the context, problem, evaluation criteria, and candidate solutions, while patterns supply candidate solutions and clarify context and criteria.
- Contextual pattern solutions. Explain that a pattern is a reusable solution to a problem in a particular context, and that a software pattern defines collaborating software elements. Describe why a solution that works in one context might not work well in another.
- Related pattern relationships. Distinguish predecessor, successor, alternative, generalization, and specialization relationships between patterns.
- Interrelated pattern language. Explain what makes a collection of related patterns a pattern language and identify the domain of the book’s example.
- Pattern language structure. Explain how the pattern language first supports a choice between monolithic and microservice architectures, then organizes patterns for problems introduced by microservices. Distinguish its three layers by the kinds of problems they address.
- Distributed operation collaboration patterns. Distinguish the four service collaboration patterns by the distributed command or query problem each addresses.
- Communication and security patterns. Explain why cross-service collaboration requires IPC and identify the communication problems the pattern groups address. Describe how the Access token pattern conveys authenticated user information to services.
- Deployment and observability challenges. Explain why deploying and troubleshooting many services is harder than doing so for a monolith. Describe the section’s proposed automation approach and examples of observability patterns.
What it builds on
- The monolithic architecture and the quality attributes for fast flow (chapter 6) · The earlier discussion relates the monolithic architecture to the quality attributes for fast flow.
- The microservice architecture: a definition (chapter 1) · Restates the definition introduced in chapter 1.
- Introduction to architectural requirements for fast flow (chapter 5) · Introduces the architectural requirements for fast flow.
- Introduction to coupling (chapter 4) · Introduces the concept of coupling.
- Software architecture is multidimensional (chapter 3) · Architecture has multiple dimensions.
- Build view (chapter 3) · Introduces the build view as a dimension of architecture.
- Loose design-time coupling enables organizations to scale (chapter 4) · The relationship between loose design-time coupling and organizational autonomy.
- Architecting for high testability (chapter 5) · The architectural requirement for testability provides context for testing a service independently.
Section by section
Introduction
The introduction explains when outgrowing a monolith can make migration to microservices sensible, then previews the chapter.
- When migration becomes sensible: Explain why a successful business-critical application might need to move from a monolithic to a microservice architecture, despite a monolith often being a good choice.
Why it matters: This gives you a reason to consider migration rather than treating microservices as the default choice.
Key terms: monolithic architecture, microservice architecture, fast flow, maintainability, testability, deployability
7.1 What is the microservice architecture exactly?
The section explains why a precise definition of microservice architecture matters before evaluating its trade-offs.
- Ambiguity of microservice architecture: Explain why calling a system a microservice architecture requires more than noting that it has multiple services or focusing on service size, and why an unclear definition makes its trade-offs harder to assess.
Why it matters: A clear meaning is needed to assess whether the architecture’s benefits and drawbacks apply.
Key terms: microservice architecture, services, benefits, drawbacks, trade-offs
7.1.1 My definition of the microservice architecture
Defines the microservice architecture through its services, subdomains, loose coupling, and independent deployability.
- Microservice architecture definition: Describe the five concepts in the author's definition: an architectural style with two or more services, each a deployable component consisting of subdomains, whose services are loosely coupled and independently deployable.
Why it matters: This definition gives you a basis for distinguishing microservices from an application that merely has multiple components.
Key terms: architectural style, subdomains, services, component, deployable unit, loosely coupled
7.1.2 Some other popular definitions
The section presents popular definitions of microservices and notes that they do not fully capture the qualities the author considers essential for fast, sustainable flow.
- Fowler and Lewis definition: Describe how Fowler and Lewis define a microservice architecture, including how services are organized, communicate, and deployed.
Why it matters: This widely cited definition provides a baseline for comparing views of microservice architecture. - Alternative definitions and limits: Distinguish Cockcroft’s concise definition from definitions that emphasize tiny, replaceable services, and state the author's reservation about these definitions.
Why it matters: The contrasting definitions show why service size alone is not the author's complete account of microservices.
Key terms: small services, business capabilities, lightweight mechanisms, independently deployable, loosely coupled, bounded contexts, replaceability, fast, sustainable flow
7.1.3 Comparing two definitions of the microservice architecture
This section compares the author’s and Fowler’s definitions of microservice architecture, highlighting their shared ideas and the author’s reasons for emphasizing fast flow and loose coupling over service size or replaceability.
- Shared Definition Concepts: Describe what the two definitions have in common: business-oriented services and independent deployability, with automated deployment and multiple technology stacks also compatible with the author’s definition.
Why it matters: The comparison shows that the definitions overlap substantially despite their different wording. - Service Size and Replaceability: Explain why the author does not make small service size or replaceability a goal of microservice architecture.
Why it matters: Treating smallness as the target can produce needless architectural complexity instead of faster flow. - Communication Technology Flexibility: Explain why the author’s definition does not specify a communication technology.
Why it matters: The architectural definition does not depend on choosing one way for services to communicate. - Loose Coupling as Defining Characteristic: Explain the distinguishing emphasis the author places on loose coupling alongside independent deployability.
Why it matters: Independent deployment alone does not capture the author’s defining requirements for fast flow.
Key terms: business capabilities, subdomains, independent deployability, automated deployment, multiple technology stacks, size, fast flow quality attributes, replaceability, evolvability, API
7.2 There’s more to the microservice architecture than just services
This section explains why defining microservice architecture only in terms of services misses important operational, build, and team dimensions.
- Multidimensional microservice architecture: Explain why a service-focused definition is incomplete and identify system operations, build architecture, and the service-team relationship as other important aspects.
Why it matters: Looking beyond services gives you a fuller way to reason about the architecture. - Cross-service operation constraints: Explain why system operations matter when partitioning subdomains into services.
Why it matters: Service boundaries affect the difficulty of operations that must cross them. - Deployment and team implications: Describe how independent deployability affects the build dimension and why the service-team relationship matters.
Why it matters: Service design has consequences for both delivery infrastructure and how teams work.
Key terms: component view, system operations, build architecture dimension, service-team relationship, distributed system operations, subdomains, independently deployable services, fast flow
7.2.1 Services in a microservice architecture
This section uses a small example to show the high-level components of a microservice architecture and notes what it may look like during migration from a monolith.
- Services and API Gateway: Describe the example application as three services—Order, Delivery, and Consumer—plus an API Gateway that routes external traffic to the services.
Why it matters: This gives you a concrete picture of the architecture before looking more closely at individual services. - Services during monolith migration: Explain why an application migrating from a monolith may initially have only a few services, including the monolith, services extracted from it, and services for new functionality.
Why it matters: A migrating application need not start with a large number of services or eliminate its monolith at once.
Key terms: services, API Gateway, component view, monolith, services extracted from it, new functionality
7.2.2 The structure of a service
This section describes a service’s subdomains, API, and private database, then distinguishes operations that implement system operations from those used for service collaboration.
- Service structure and boundaries: Describe how a service contains one or more subdomains and exposes an API while keeping its database private. Explain that a subdomain may belong solely to one service or be a shared library used by multiple services.
Why it matters: This identifies what a service exposes to others and what remains an implementation detail. - Service API operation roles: Distinguish service operations that implement system operations from operations used only for collaboration between services. Describe the API’s operations and events, including that operations may be invoked synchronously or asynchronously.
Why it matters: The distinction clarifies why an operation appears in a service API even when it is not itself a system operation.
Key terms: service, subdomain, API, private implementation detail, shared library, operations, events, system operations, collaboration, synchronously
7.2.3 Operations in a microservice architecture
This section distinguishes local from distributed system operations and explains how a distributed operation begins and involves multiple services.
- Two kinds of system operations: Distinguish local operations, which one service handles entirely, from distributed operations, which span multiple services.
Why it matters: This distinction identifies when fulfilling a request requires services to work together. - Distributed operation entry point: Trace a distributed operation from the service that first handles the request to its collaboration with other services, and state how its implementation complexity usually compares with a local operation.
Why it matters: It gives you a basic way to describe how a request crosses service boundaries without assuming one service does all the work.
Key terms: system operations, local operations, distributed operations, distributed operation, entry point, collaborates
7.2.4 Build architecture dimension
This section explains how multi-repo and monorepo build architectures support—or complicate—independent service deployment.
- Independent deployment requirement: Explain that a microservice build architecture can be structured in different ways, but it must support independently deployable services.
Why it matters: Repository and build choices need to preserve a service’s ability to be deployed on its own. - Repository structure tradeoffs: Distinguish the multi-repo and monorepo options by how they organize service code and by their deployment, scaling, and global-change tradeoffs.
Why it matters: The two layouts make different kinds of work easier, so choosing between them affects both service releases and cross-service changes.
Key terms: build architecture dimension, independently deployable services, multi-repo, monorepo, deployment pipeline, global changes
7.2.5 Services <⇒ teams
This section explains how service ownership affects team autonomy and why services and teams do not always map one-to-one.
- Single-team service ownership: Explain why a service is ideally owned by one team and how loose design-time coupling lets that team develop, test, and deploy independently.
Why it matters: It connects a service boundary to a team's ability to deliver changes without waiting on other teams. - Flexible service-team mapping: Describe why services and teams do not have to map one-to-one, including how subdomains owned by different teams can share a service and why network costs might justify that arrangement.
Why it matters: It prevents treating one-team-per-service as an absolute rule when choosing service boundaries.
Key terms: service, team, loosely design-time coupled, team’s autonomy, subdomains, shared library, collocated, autonomy
7.3 Essential characteristics of the microservice architecture
This section identifies the two characteristics services need to deliver the benefits of a microservice architecture and warns what happens without them.
- Essential service characteristics: Explain why independent deployability and loose coupling are essential to a microservice architecture, and describe the risk when services lack them.
Why it matters: Having services is not enough if the resulting architecture cannot deliver the benefits of microservices.
Key terms: independently deployable, loosely coupled, distributed monolith
7.3.1 Essential characteristic #1: Services are independently deployable
This section explains what makes a microservice independently deployable and why that enables faster, safer releases with less cross-team coordination.
- Deployable unit and pipeline: Explain why a service must be both a deployable component and have its own pipeline that builds, tests, and deploys it; packaging alone is insufficient.
Why it matters: A separate package does not give a team release autonomy if deployment remains shared. - Production readiness through isolated testing: Describe how a service can be production-ready after its own tests, including how those tests invoke its API and handle collaborators.
Why it matters: A service can leave its pipeline ready for production without requiring all its collaborators to be deployed for testing. - Contracts for separate service tests: Explain how consumer-driven contract tests check service interactions without testing services together, and why maintaining those tests can be costly.
Why it matters: Contracts offer a way to check compatibility without making every service’s release wait for an application-wide test. - Faster releases with less coordination: Justify why independent deployability improves pipeline speed and reliability and reduces coordination between teams, compared with testing services together.
Why it matters: Independent deployability helps teams release safely without turning each change into an application-wide coordination exercise.
Key terms: component, deployable unit, deployment pipeline, tested in isolation, production-ready, test doubles, API, consumer-driven contract tests, contract, design-time coupling
7.3.2 Essential characteristic #2: Services are loosely coupled
This section explains why loosely coupled services are essential to a microservice architecture and how four kinds of coupling affect services differently.
- Loose design-time coupling: Explain why changes that must be coordinated across services impede fast flow, and describe how a breaking service API change can be rolled out without breaking clients.
Why it matters: Independent deployment does not make change fast if teams repeatedly have to coordinate changes to their services. - Runtime coupling consequences: Explain the consequences of tight runtime coupling between services and the service-design response the section suggests.
Why it matters: Service boundaries must account for availability and latency, not just the ability to deploy services independently. - Build-time coupling boundaries: Explain why build-time coupling is usually less of an issue between microservices, while it can still exist within a service.
Why it matters: It distinguishes a coupling problem that service separation usually removes from one that may remain inside each service. - Infrastructure coupling choices: Describe how deployment choices determine infrastructure coupling between services and the trade-off involved.
Why it matters: Separate services are not automatically free of dependencies created by shared infrastructure.
Key terms: design-time coupling, lock step changes, breaking change, modifiability, runtime coupling, latency, availability, subdomains, build-time coupling, independently deployable components
7.4 Benefits of the microservice architecture
Introduces fast flow as the microservice architecture’s most important benefit and previews other benefits discussed later.
7.4.1 Enables fast, sustainable flow
The section explains how microservices enable fast, sustainable flow through modifiability, evolvability, testability, deployability, and observability.
- Modifiability through loose coupling: Explain how loose design-time coupling lets teams change their services independently, and why maintaining that coupling takes ongoing effort.
Why it matters: Independent changes help teams maintain a fast pace without constantly coordinating. - Incremental technology stack evolution: Explain why a multi-component microservice architecture makes technology-stack upgrades easier to schedule and prioritize.
Why it matters: Smaller upgrades make technological change easier to fit into ongoing delivery. - Fast independent service testing: Describe how small, independently testable services and separate pipelines keep testing from becoming a bottleneck.
Why it matters: Fast verification helps changes reach production without waiting on a large shared test process. - Independent and reliable deployments: Explain how small, independently deployable services allow frequent, reliable production deployments without cross-team coordination.
Why it matters: Independent deployments prevent release coordination from slowing the flow of changes. - Fine-grained service telemetry: Explain how telemetry from individual service instances improves insight into application behavior compared with monolithic application-instance telemetry.
Why it matters: More specific telemetry helps teams understand behavior and diagnose problems.
Key terms: modifiability, loose design-time coupling, dependencies between services, evolvability, multi-component architecture, technology stack, testability, testable in isolation, fast-running automated tests, deployment pipeline
7.4.2 Supports multiple technology stacks
This section explains how microservices let teams choose suitable technology stacks while keeping those choices governed and making new technologies safer to try.
- Service-specific technology choices: Explain how a microservice architecture lets each service use a technology stack suited to its needs, and why the organization must still manage its approved technologies.
Why it matters: Technology flexibility is useful when it serves each service’s needs without becoming unmanaged choice. - Lower-risk technology experiments: Describe how a team can try a new stack in one service and what follows if the experiment succeeds or fails.
Why it matters: A limited experiment lets an organization evaluate a new stack without committing the whole application to it.
Key terms: technology stack, right tool for the right job, approved technologies, new technology stack, proven technology stack
7.4.3 Enables an organization to scale
Explains why service ownership and separate deployment pipelines let an organization grow without slowing software delivery.
- Monolith scaling bottlenecks: Explain why adding developers to even a well-structured monolith can slow delivery as an organization grows.
Why it matters: More developers do not necessarily mean faster delivery when they must share a pipeline and coordinate tightly. - Service ownership and pipelines: Describe how a microservice architecture lets an organization add teams while continuing to deliver features rapidly.
Why it matters: Separate service ownership and pipelines help growth remain compatible with fast flow.
Key terms: fast flow, deployment pipeline, design-time coupling, sustainable scale, services, build architecture
7.4.4 Improves the developer experience
This section explains how working on a small, mostly independent service improves developers’ focus, feedback, and productivity.
- Service Developer Experience: Explain why working on a service can improve the developer experience: developers can focus on their service’s business logic, handle a smaller code base, and get faster feedback from tests and deployment.
Why it matters: It connects the way service teams work to a concrete benefit for developers.
Key terms: developer experience, cognitive load, feedback, flow, distributed operations
7.4.5 Enables segregation of subdomains by characteristics
This section explains how separating subdomains into services according to their differing characteristics can improve resource use, development practices, availability, security, and focus on core business logic.
- Independent scaling by resource needs: Explain why subdomains with different resource and instance needs can be cheaper to run as separate services, using Order Management and Fraud Detection as an example.
Why it matters: Service boundaries can prevent costly over-provisioning when subdomains need different hardware or capacity. - Isolation of regulated development: Explain how separating regulated subdomains lets unregulated subdomains retain different development practices.
Why it matters: A regulated part of an application need not impose its development process on every other part. - Availability by business criticality: Explain how separating business-critical functionality from less-critical functionality can protect its availability.
Why it matters: A change or resource spike in less-critical functionality should not jeopardize vital operations. - Sensitive data service boundary: Explain how isolating a sensitive-data subdomain in its own service can improve security.
Why it matters: Isolation gives an application clearer places to restrict access to sensitive data. - Core subdomain development focus: Distinguish core, supporting, and generic subdomains, and explain why putting core subdomains in separate services can speed their development.
Why it matters: Separating what differentiates the business helps teams iterate on it without unrelated functionality holding them back.
Key terms: subdomain, service instance, resource requirements, independently, domain-specific software development regulations, regulated subdomains, DevOps practices, business criticality, availability, resource contention
7.5 Drawbacks of the microservice architecture
Introduces the microservice architecture’s central tradeoff: the distributed structure that enables its benefits also brings significant drawbacks.
- Microservice architecture tradeoff: Explain why the microservice architecture’s strengths also come with drawbacks.
Why it matters: The benefits of microservices need to be weighed against the costs of a distributed architecture.
Key terms: distributed architecture, loosely coupled, independently deployable services, drawbacks
7.5.1 Distributed operations are complicated
This section explains why operations that span microservices are harder to design than local operations, focusing on network costs, runtime coupling, and transaction management.
- Cross service operation boundaries: Explain why an operation spanning services is more complicated than a local operation, even when important operations are kept within one service.
Why it matters: Recognizing these boundaries explains why distributing an operation creates design work that a local operation does not have. - Network latency and service boundaries: Explain how network communication affects a distributed operation and how its SLO guides the trade-off between performance and team autonomy.
Why it matters: Service boundaries should reflect the operation’s actual performance needs, not just the fact that network calls are relatively slow. - Runtime coupling and availability: Describe runtime coupling in a distributed operation, its possible effects, and when it warrants an architectural change.
Why it matters: This distinction helps you assess a service dependency by its effect on availability and latency rather than treating every dependency as unacceptable. - Service scoped transaction approach: Explain why one ACID transaction is unsuitable for an operation spanning loosely coupled services and describe the section’s preferred approach.
Why it matters: It explains the transaction boundary behind the section’s choice of eventual consistency for distributed operations. - Eventual consistency trade-offs: Describe the temporary inconsistency and availability benefit of a distributed command built from local transactions, along with its transaction-management costs.
Why it matters: The availability gain is easier to evaluate when you can also name the consistency and application-design work it entails.
Key terms: distributed operation, local system operation, process and transaction boundaries, network communication, latency, Service Level Objective (SLO), team autonomy, runtime coupling, service boundaries, SLOs
7.5.2 Implementing changes that span services is complicated
This section explains why microservices make changes within one service easier but require careful coordination when a change spans services.
- Local and cross-service trade-off: Explain why changes within one service can be faster than in a monolith, while changes spanning services can be harder, and why service boundaries should keep most changes local.
Why it matters: The speed advantage of microservices depends in part on how often a change crosses service boundaries. - Compatible API deployment order: Explain why the example's backward-compatible Consumer Service API change still imposes a deployment order.
Why it matters: An API change can preserve old clients and still require teams to coordinate deployment order. - Breaking API rollout sequence: Describe the non-breaking sequence used to roll out the example's breaking Consumer Service API change without causing a production outage.
Why it matters: Keeping both API versions available during migration prevents an abrupt change from breaking clients in production.
Key terms: independently deployable, cross-service changes, service boundaries, subdomains, backwards compatible change, ordering dependency, reserveCredit(), availableCredit, breaking change, API version
7.5.3 Designing a good microservice architecture is challenging
This section explains why service boundaries make microservice design consequential, how poor boundaries can create a distributed monolith, and why design alternatives require careful trade-off analysis.
- Consequences of service boundaries: Explain why placing subdomains used by the same system operation in separate services is more consequential than placing classes in different packages.
Why it matters: A service boundary affects more than where code lives. - Distributed monolith failure modes: Describe how tight coupling between services can produce a distributed monolith and why that makes design mistakes costly.
Why it matters: Having separate services does not by itself prevent cross-service change and failure cascades. - Service design trade-offs: Explain why adding a subdomain and a spanning operation creates multiple design alternatives that require disciplined evaluation.
Why it matters: Choosing the easiest implementation of one operation may leave the overall service design worse.
Key terms: process and transaction boundaries, subdomains, system operation, distributed monolith, design-time coupled, runtime coupled, design alternatives, new subdomain, trade-offs
7.5.4 Operational challenges
This subsection explains why microservices are harder to operate than a monolith and how tools help without eliminating that difficulty.
- Microservice operational complexity: Explain why deploying and operating microservices is challenging compared with operating a monolith, including the difficulty of troubleshooting emergent behavior.
Why it matters: The operational cost of microservices includes understanding the behavior of the whole system, not just deploying individual services. - Limits of operational tools: Describe how containers, orchestration platforms, and observability tools help with microservice operations, and state their limit.
Why it matters: These tools reduce operational friction without making a microservice system simple to run.
Key terms: runtime architecture, emergent behavior, container technologies, orchestration platforms, observability tools
7.5.5 Embracing independent deployability is a significant change
The section explains why application-wide acceptance tests undermine independent service deployment and how service-level tests provide an alternative.
- Application-Level Testing Friction: Explain why user acceptance tests that work for a monolith can prevent independent deployment in a microservice architecture, and why insisting on testing services together creates a distributed monolith.
Why it matters: A testing requirement can defeat independent deployability even when the application has been split into services. - Service-Level Acceptance Tests: Describe how service-level acceptance tests replace application-level tests: they test each service in isolation while using knowledge of service collaboration to verify its behavior.
Why it matters: Tests organized around individual services support independent deployment while still checking how each service participates in a workflow.
Key terms: application-level user acceptance tests, independent deployability, distributed monolith antipattern, service-level user acceptance tests, white box tests, Order Service, createOrder(), reserveCredit()
7.5.6 Refactoring a monolith to microservice architecture is challenging
The section explains why organizations often move from a monolith to microservices only after outgrowing it, and why that migration is difficult despite its potential benefits.
- Timing of microservice adoption: Explain why a monolith is usually the better choice for a greenfield application and when organizations commonly adopt microservices instead.
Why it matters: The reason for adopting microservices depends on the problems the application actually has. - Difficulty of monolith migration: Explain what makes migration from a monolith to microservices challenging and why organizations may undertake it anyway.
Why it matters: The potential payoff of microservices must be weighed against a migration that may take years.
Key terms: greenfield applications, monolithic architecture, microservice architecture, migrating a monolith, legacy code, microservices-based architecture
7.6 An overview of the microservice architecture pattern language
This section explains why patterns help developers make deliberate design decisions in a complex microservice architecture.
- Patterns in deliberative design: Explain why deliberative design is challenging for microservices and how patterns help: designers must understand the context, problem, evaluation criteria, and candidate solutions, while patterns supply candidate solutions and clarify context and criteria.
Why it matters: Patterns are aids to evaluating design choices, not just ready-made solutions.
Key terms: deliberative design process, patterns, context, evaluation criteria, candidate solutions
7.6.1 Patterns and pattern languages
Defines patterns and pattern languages, then explains how a pattern’s forces, consequences, and relationships help guide architectural decisions.
- Contextual pattern solutions: Explain that a pattern is a reusable solution to a problem in a particular context, and that a software pattern defines collaborating software elements. Describe why a solution that works in one context might not work well in another.
Why it matters: Checking the context helps you decide whether a familiar solution fits the problem at hand. - Forces and design tradeoffs: Explain what a pattern’s forces are and why they must sometimes be prioritized rather than all satisfied.
Why it matters: Explicit forces make the tradeoffs behind a design choice easier to discuss. - Resulting context and consequences: Describe the three parts of a pattern’s resulting context and how they give a fuller picture of the solution.
Why it matters: Considering drawbacks and new issues alongside benefits supports less biased design decisions. - Related pattern relationships: Distinguish predecessor, successor, alternative, generalization, and specialization relationships between patterns.
Why it matters: These relationships help you see which patterns are choices and which address problems created by earlier choices. - Interrelated pattern language: Explain what makes a collection of related patterns a pattern language and identify the domain of the book’s example.
Why it matters: A pattern language places individual solutions in the context of other solutions needed for the same domain.
Key terms: pattern, context, software pattern, forces, resulting context, benefits, drawbacks, issues, related patterns, predecessor
7.6.2 Overview of the microservice architecture pattern language
This section maps the microservice architecture pattern language to the problems it helps solve, from choosing an architecture to collaborating, communicating, testing, deploying, and operating services.
- Pattern language structure: Explain how the pattern language first supports a choice between monolithic and microservice architectures, then organizes patterns for problems introduced by microservices. Distinguish its three layers by the kinds of problems they address.
Why it matters: The organization makes it easier to find a pattern for the problem at hand rather than treating microservices as one design decision. - Distributed operation collaboration patterns: Distinguish the four service collaboration patterns by the distributed command or query problem each addresses.
Why it matters: These distinctions connect a cross-service operation to the kind of collaboration it requires. - Communication and security patterns: Explain why cross-service collaboration requires IPC and identify the communication problems the pattern groups address. Describe how the Access token pattern conveys authenticated user information to services.
Why it matters: Collaboration patterns need ways to exchange requests or messages, and services need user context when handling them. - Isolated service testing patterns: Explain why service tests should check collaboration without relying on complex end-to-end tests, and distinguish the three isolation-oriented testing patterns listed.
Why it matters: Testing collaboration without requiring many services to run together can keep verification simpler and faster. - Deployment and observability challenges: Explain why deploying and troubleshooting many services is harder than doing so for a monolith. Describe the section’s proposed automation approach and examples of observability patterns.
Why it matters: Operating a service-based application requires both repeatable deployment and ways to follow behavior across service boundaries. - Reusable cross-cutting service foundations: Explain why repeating cross-cutting work for every service is problematic and distinguish what a Service Template and a Microservice Chassis provide.
Why it matters: Reusable foundations let teams create services without repeatedly rebuilding the same supporting capabilities.
Key terms: pattern language, application architecture patterns, infrastructure patterns, application infrastructure patterns, application patterns, distributed operation, Saga, Command-side replica, API Composition, CQRS
7.7 Summary
Where this is used later
- Interaction styles (chapter 8) · Introduces interaction styles for interprocess communication.
- Overview of messaging (chapter 8) · Assumes the distinction between a service’s business logic and its interfaces.
- (chapter intro) (chapter 8) · Some operations in a microservice architecture span services.
- Evolving APIs (chapter 8) · Provides the reason that evolving a service API without breaking its clients matters.
- ACID transactions in a microservice architecture (chapter 9) · Provides the transaction-management constraint for system commands spanning services.
- The structure of a saga (chapter 9) · Provides the local-transaction foundation for understanding a saga’s structure.
- Handling saga’s lack of isolation (chapter 9) · Builds on the lack of a single isolated transaction when handling saga anomalies.
- Challenges implementing findOrder() in a microservice architecture (chapter 12) · Builds on the difficulty of obtaining a strongly consistent view across services.
Concepts explained in this chapter
- microservice architectureAn architectural style that structures an application as a collection of independently deployable services aligned with business capabilities.
- microservice architecture pattern languageAn organized collection of related patterns for making architectural and design decisions about microservice systems.
- contract testingTesting that verifies services and their clients or collaborators conform to agreed interaction contracts without requiring them to be tested together.
- independent deploymentA deployment arrangement in which application modules are packaged and released as independently deployable services.
- API compositionA service collaboration pattern that invokes multiple service APIs and combines their results into a response.
- CQRSA distributed query pattern that maintains a read-only queryable replica combining data from multiple services.
- command-side replicaA command-side replica is a service collaboration pattern that maintains replicated data to support distributed command processing.
- sagaA distributed transaction pattern that coordinates a sequence of local transactions and, when necessary, compensating actions across services.
- distributed operationA distributed operation is an application operation whose execution spans multiple services and requires inter-service communication.
- loose couplingAn architectural property in which software elements have limited dependencies on one another, allowing them to change more independently.
- multi-repoMulti-repo is a repository arrangement in which application services or components are maintained in separate repositories.
- componentA modular structural unit of a software system that groups related implementation or functionality.
- GitOpsAn operational approach that manages infrastructure and applications declaratively through version-controlled Git state and automated reconciliation.
- Microservice ChassisA reusable service framework that provides common infrastructure capabilities and conventions for microservices.
- access token patternAn authentication and authorization pattern in which a gateway passes a validated bearer token containing user information to invoked services.
- communication patternA pattern category for implementing inter-process and client-to-service communication in a distributed application.
- consumer-side contract testA contract test that verifies a service client can communicate correctly with the service.
- cross-cutting concernA cross-cutting concern is an architectural concern that affects multiple services or components rather than a single service.
- deployment platformA platform that automates applying desired application and infrastructure state to a runtime environment.
- distributed tracing systemDistributed tracing is the recording and analysis of request execution across multiple distributed software components.
- exception trackingThe collection, deduplication, alerting, and resolution tracking of application exceptions.
- health check endpointAn endpoint that can be invoked to determine whether a service instance is healthy and available to handle requests.
- interprocess communicationInterprocess communication is the exchange of data or control between independently executing processes through mechanisms such as network calls or message passing.
- log aggregationLog aggregation is the centralized collection and organization of log records from multiple application components or instances.
- observability patternA reusable architectural pattern for making an application's runtime behavior and user activity understandable from operational outputs.
- security patternA pattern category for protecting communication and services in a distributed architecture.
- service collaboration patternA recurring architectural solution for coordinating interactions and distributed operations among services.
- service component testA test that exercises a service in isolation from other services.
- service deployment patternA pattern category for deploying and managing the many independently deployable services in a microservice application.
- service templateA reusable template that provides a standardized starting structure and infrastructure for implementing a service.
- deployment pipelineAn automated sequence that takes a software change through building, testing, and deployment.
- test doubleA test double is a substitute component that simulates the behavior of a real collaborator or dependency during testing.
- subdomainA coherent area of business responsibility within a larger domain.
- eventual consistencyA consistency model in which a multi-service operation is completed through separate transactions whose effects converge over time rather than immediately satisfying a single ACID transaction.
- service-level objectiveA target value for a service-level indicator that expresses a desired level of reliability or performance.
- transaction managementTransaction management is the coordination of transactional operations to preserve the required consistency and completion semantics of data changes.
- two-phase commitTwo-phase commit is a distributed transaction protocol that coordinates participants through a prepare phase and a commit or rollback phase.
- patternA pattern is a reusable solution to a recurring design or architectural problem in a particular context.
- business criticalityBusiness criticality is the degree to which a software capability is essential to an organization's business operations or value generation.
- core subdomainA core subdomain contains business logic that is unique to an organization and provides competitive advantage.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
