liveBook · Manning

What you will learn in Microservices Patterns, Second Edition

Designing applications for fast flow and high reliability

by Chris Richardson · Manning Early Access Program (MEAP)

Chapter by chapter

Chapter 1: Microservices: an architecture for fast flow

The introduction frames faster, more reliable, lower-risk software delivery as the reason to consider microservices, while stressing that they are appropriate only for some applications.

1.1 The need for fast flow · 1.1.1 The software delivery feedback loop · 1.1.2 Fast flow: continuous change and feedback · 1.1.3 The fast flow success triangle = DevOps + Team Topologies + Architecture · 1.2 Architectural requirements for fast flow · 1.2.1 Architectural requirements for fast flow · 1.2.2 The Monolithic architecture can enable fast flow · 1.3 A brief introduction to the microservice architecture · 1.3.1 The microservice architecture: a definition · 1.3.2 The microservice architecture is a fast flow architecture · 1.3.3 Other benefits of the microservice architecture · 1.3.4 No such thing as a silver bullet: the drawbacks of microservices · 1.4 When to use the microservice architecture · 1.4.1 Building an application from scratch: typically a monolith-first approach · 1.4.2 Refactoring a monolith to the microservice architecture · 1.5 Summary

What you learn in chapter 1 →

Chapter 2: FTGO: A case study in moving from one kind of development hell to another

The chapter introduces FTGO’s move from an outgrown monolith to microservices as a case where a suitable architectural choice still went badly wrong.

2.1 FTGO architecture V1: The eventual descent into monolithic hell · 2.1.1 The architecture of the FTGO application · 2.1.2 Why the monolithic architecture worked well initially · 2.1.3 Living in what they thought was monolithic hell · 2.2 FTGO architecture V2: Fine-grained microservices everywhere - a different kind of hell · 2.2.1 How FTGO adopted the microservice architecture · 2.2.2 The V2 architecture of the main FTGO application · 2.2.3 What worked well with the V2 architecture · 2.2.4 What went wrong with their microservice architecture · 2.3 Summary

What you learn in chapter 2 →

Chapter 3: Software architecture: what is it, why does it matter and who does it?

The introduction argues that understanding architecture fundamentals is necessary before deciding when and how to use microservices, then previews the chapter’s topics.

3.1 What is software architecture and why does it matter? · 3.1.1 An application as a black box · 3.1.2 Software architecture: a way to reason about your application · 3.1.3 Why architecture matters · 3.2 Software architecture is multidimensional · 3.2.1 Domain view · 3.2.2 Component view · 3.2.3 Deployment view · 3.2.4 Build view · 3.2.5 +1 Scenarios · 3.3 Overview of architectural styles · 3.3.1 Layered architecture · 3.3.2 About the hexagonal architecture style · 3.4 Architecting: what is it, who does it and when? · 3.4.1 Architecture as a series of design decisions · 3.4.2 Who defines an application’s architecture? · 3.4.3 When to architect? · 3.5 Summary

What you learn in chapter 3 →

Chapter 4: The importance of loose coupling

Introduces loose coupling, defines when software elements are coupled, and explains why different forms of coupling matter to change speed and runtime behavior.

4.1 Introduction to coupling · 4.1.1 Four flavors of coupling · 4.1.2 Why loose coupling matters · 4.2 Design-time coupling · 4.2.1 Design-time coupling and cohesion · 4.2.2 Benefits of loose design-time coupling · 4.2.3 Loose design-time coupling enables organizations to scale · 4.2.4 Designing loosely design-time coupled software · 4.3 Build-time coupling · 4.3.1 About build-time coupling in Gradle projects · 4.3.2 A project should only be build-time coupled to stable projects · 4.3.3 Reducing build-time coupling within a Gradle subproject · 4.4 Runtime coupling · 4.4.1 An example of tight runtime coupling · 4.4.2 Siloed organization can lead to tight runtime coupling · 4.4.3 Minimizing runtime coupling · 4.5 Infrastructure coupling · 4.5.1 An example of infrastructure coupling · 4.5.2 Two types of infrastructure coupling · 4.5.3 Minimizing infrastructure coupling · 4.6 Summary

What you learn in chapter 4 →

Chapter 5: Architectural requirements for fast flow

The introduction frames fast flow as an architectural concern and identifies five quality attributes for assessing it.

5.1 Introduction to architectural requirements for fast flow · 5.1.1 Step #1: Making a change · 5.1.2 Step #2: deploy changes · 5.1.3 Step #3: analyze feedback from production and end-users · 5.2 Modifiability: ease and speed of change · 5.2.1 Quality attribute scenarios for modifiability · 5.2.2 Modifiability requires loose design-time coupling and high cohesion · 5.3 Evolvability: ease and speed of changing the technology stack · 5.3.1 About technology stacks · 5.3.2 Technology evolves · 5.3.3 Evolvability quality attribute scenarios · 5.3.4 Architecting for high evolvability · 5.4 Testability: ease and speed of verifying releasability · 5.4.1 Quality attribute scenarios · 5.4.2 Architecting for high testability · 5.4.3 Testable using automated tests · 5.4.4 Testable using fast running tests · 5.4.5 Running testing locally · 5.5 Deployability: ease, speed and reliability of deployments · 5.5.1 Deployability quality attribute scenarios · 5.5.2 Architecting for high deployability · 5.6 Observability: ease of understanding an application’s runtime behavior · 5.6.1 Quality attribute scenarios for observability · 5.6.2 Architecting for observability · 5.7 Summary

What you learn in chapter 5 →

Chapter 6: The monolithic architecture

The chapter introduction explains why a monolith can remain a good choice despite the fast-flow advantages often associated with multi-component architectures.

6.1 About the monolithic architecture · 6.1.1 Benefits of the monolithic architecture · 6.1.2 The monolithic architecture and the quality attributes for fast flow · 6.1.3 Other drawbacks of monolithic architecture · 6.1.4 The monolithic architecture pattern language · 6.2 Modularizing the monolith · 6.2.1 A technology-oriented architectural style for the domain architecture · 6.2.2 Introduction to the modular monolith · 6.2.3 Domain module design · 6.2.4 Designing system operations that span domains · 6.2.5 Testing strategy for a modular monolith · 6.3 Minimizing build-time coupling to improve testability and deployability · 6.3.1 About physical design principles · 6.3.2 Define build projects for domain module APIs · 6.3.3 Apply the Interface segregation principle · 6.3.4 Segregate implementation build projects · 6.4 The limitations of the modular monolith · 6.4.1 A modular monolith is still a monolith · 6.4.2 The myth of the microservices-ready modular monolith · 6.5 Summary

What you learn in chapter 6 →

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.

7.1 What is the microservice architecture exactly? · 7.1.1 My definition of the microservice architecture · 7.1.2 Some other popular definitions · 7.1.3 Comparing two definitions of the microservice architecture · 7.2 There’s more to the microservice architecture than just services · 7.2.1 Services in a microservice architecture · 7.2.2 The structure of a service · 7.2.3 Operations in a microservice architecture · 7.2.4 Build architecture dimension · 7.2.5 Services <⇒ teams · 7.3 Essential characteristics of the microservice architecture · 7.3.1 Essential characteristic #1: Services are independently deployable · 7.3.2 Essential characteristic #2: Services are loosely coupled · 7.4 Benefits of the microservice architecture · 7.4.1 Enables fast, sustainable flow · 7.4.2 Supports multiple technology stacks · 7.4.3 Enables an organization to scale · 7.4.4 Improves the developer experience · 7.4.5 Enables segregation of subdomains by characteristics · 7.5 Drawbacks of the microservice architecture · 7.5.1 Distributed operations are complicated · 7.5.2 Implementing changes that span services is complicated · 7.5.3 Designing a good microservice architecture is challenging · 7.5.4 Operational challenges · 7.5.5 Embracing independent deployability is a significant change · 7.5.6 Refactoring a monolith to microservice architecture is challenging · 7.6 An overview of the microservice architecture pattern language · 7.6.1 Patterns and pattern languages · 7.6.2 Overview of the microservice architecture pattern language · 7.7 Summary

What you learn in chapter 7 →

Chapter 8: Interprocess communication in a microservice architecture

The introduction explains why interprocess communication is central to microservices and why choosing an IPC mechanism is an architectural decision.

8.1 Overview of interprocess communication in a microservice architecture · 8.1.1 Interaction styles · 8.1.2 Defining APIs in a microservice architecture · 8.1.3 APIs have Service Level Objectives (SLOs) · 8.1.4 API Security · 8.1.5 Evolving APIs · 8.1.6 Message payload formats · 8.1.7 Developing API clients · 8.2 Communicating using the synchronous remote procedure invocation pattern · 8.2.1 Benefits and drawbacks of RPI · 8.2.2 Using REST · 8.2.3 Using gRPC · 8.2.4 Implementing resilient synchronous communication · 8.2.5 Using service discovery · 8.3 Communicating using the asynchronous messaging pattern · 8.3.1 Overview of messaging · 8.3.2 Implementing the interaction styles using messaging · 8.3.3 Designing an asynchronous messaging architecture · 8.3.4 Evolving an asynchronous API · 8.3.5 AsyncAPI - an IDL for messaging-based APIs · 8.3.6 Pattern: Ordered competing receivers · 8.3.7 Pattern: Idempotent consumer pattern · 8.3.8 Pattern: Transaction outbox · 8.3.9 Synchronously invoking an asynchronous implementation · 8.3.10 Libraries and frameworks for messaging · 8.4 Summary

What you learn in chapter 8 →

Chapter 9: Implementing system commands with sagas

The chapter introduces sagas as a service collaboration pattern for commands that update data across multiple services.

9.1 Transaction management in a microservice architecture · 9.1.1 System commands need to be transactional · 9.1.2 ACID transactions in a microservice architecture · 9.2 Using the Saga pattern · 9.2.1 An example saga: The Create Order saga · 9.2.2 The structure of a saga · 9.2.3 Overview of saga coordination · 9.2.4 Benefits and drawbacks of sagas · 9.3 Handling saga’s lack of isolation · 9.3.1 Overview of anomalies · 9.3.2 Countermeasures for handling the lack of isolation · 9.4 Summary

What you learn in chapter 9 →

Chapter 10: Saga coordination mechanisms

Introduces what saga coordination must accomplish and distinguishes choreography’s event-driven control from orchestration’s dedicated orchestrator.

10.1 Choreography-based sagas · 10.1.1 The choreography-based version of the Create Order Saga · 10.1.2 Design elements: events, channels, publishers and handlers · 10.1.3 Using fan-out choreography · 10.1.4 Benefits and drawbacks of choreography-based saga coordination · 10.2 Orchestration-based sagas · 10.2.1 Example orchestration-based Create Order Saga · 10.2.2 Implementing the saga orchestrator · 10.2.3 Location of orchestrator · 10.2.4 Implementing orchestration using asynchronous messaging · 10.2.5 Implementing orchestration using synchronous request/response · 10.2.6 Benefits and drawbacks of orchestration-based sagas · 10.3 Summary

What you learn in chapter 10 →

Chapter 11: The design of the FTGO 'Create Order saga'

Introduces the FTGO Create Order saga as a concrete application of earlier saga concepts and outlines the chapter’s design topics.

11.1 An overview of the FTGO Create Order saga · 11.1.1 The FTGO Create Order Saga definition · 11.1.2 The Create Order Saga's orchestrators design · 11.1.3 The Eventuate Platform’s Tram Saga framework · 11.2 The Create Order Saga orchestrator design · 11.2.1 The OrderSagaService class · 11.2.2 The CreateOrderSaga orchestrator class · 11.2.3 The CreateOrderSagaState class · 11.2.4 The OrderService class · 11.2.5 The saga participant proxy classes · 11.3 The saga participant command handlers · 11.4 Summary

What you learn in chapter 11 →

Chapter 12: Using the API Composition pattern to implement system queries

The introduction explains why queries spanning multiple services need application-level collaboration rather than database-level joins or distributed transactions.

12.1 The challenge of querying in the microservice architecture · 12.1.1 System queries typically support the UI · 12.1.2 The findOrder() system query · 12.1.3 Why system queries need to be transactional · 12.1.4 Implementing findOrder() in a monolith is straightforward · 12.1.5 Challenges implementing findOrder() in a microservice architecture · 12.1.6 Overview of the service collaboration patterns for queries · 12.2 Using the API composition pattern · 12.2.1 Overview of the API Composition pattern · 12.2.2 Implementing the findOrder() system query using the API composition pattern · 12.2.3 Benefits · 12.2.4 Drawbacks · 12.3 API composition design issues · 12.3.1 The location of the API composer · 12.3.2 Designing the provider queries and composition logic · 12.3.3 Resilient and performant API Composition · 12.4 Summary

What you learn in chapter 12 →

Chapter 13: Using the CQRS pattern to implement system queries

The introduction explains why some queries need a query-specific CQRS view instead of querying data-owning services, and identifies the resulting tradeoff.

13.1 When API Composition isn’t the solution · 13.1.1 Distributed queries that can’t use the API Composition pattern · 13.1.2 Challenging single-service queries · 13.2 Using the CQRS pattern · 13.2.1 Overview of the CQRS pattern · 13.2.2 The benefits of the CQRS pattern · 13.2.3 The drawbacks of the CQRS pattern · 13.3 Designing a CQRS view for a system query · 13.3.1 Selecting the view database · 13.3.2 Designing the view schema · 13.3.3 Designing the view repository · 13.3.4 Designing the provider events and their handlers · 13.3.5 Deploying and updating the view service · 13.4 Summary

What you learn in chapter 13 →

Concepts explained in this book

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.