Monolith to Microservices: Evolutionary Patterns to Transform Your Monolith 1st Edition


Monolith to Microservices: Evolutionary Patterns to Transform Your Monolith 1st Edition

Author: Sam Newman
Edition: 1st Edition
Year: 2019
Language: English
ISBN 13: 978-1492047841
Publisher: O’Reilly Media
ISBN 10: 1492047848
Pages: 272
File: PDF
Price: 5.99$
Digital delivery: Via Email check your SPAM

Monolith to Microservices: Evolutionary Patterns to Transform Your Monolith 1st Edition

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 ebook 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.

From the Preface

A few years ago, some of us were chatting about microservices being an interesting idea. The next thing you know it’s become the default architecture for hundreds of companies around the world (many probably launched as startups aiming to solve the problems microservices cause) and has everyone running to jump on a bandwagon that they are worried is about to disappear over the horizon.

I must admit, I’m partly to blame. Since I wrote my own book on this subject, Building Microservices, back in 2015, I’ve made a living working with people to help them understand this type of architecture. What I’ve always tried to do is to cut through the hype, and help companies decide if microservices are right for them. For many of my clients with existing (non-microservice-oriented) systems, the challenge has been about how to adopt microservice architectures. How do you take an existing system and rearchitect it without having to stop all other work?

That’s where this book comes in. As importantly, I’ll aim to give you an honest appraisal of the challenges associated with microservice architecture, and help you understand whether starting this journey is even right for you.

This book is designed as a deep dive into how you think about, and execute, breaking apart existing systems into a microservice architecture.

What You Will Learn from this ebook Monolith to Microservices

We will touch on many topics related to microservice architecture, but the focus is on the decomposition side of things. For a more general guide to microservice architectures, my previous book Building Microservices would be a good place to start. In fact, I strongly recommend that you consider that book to be a companion to this one.

Table of Contents


1. Just Enough Microservices
What Are Microservices?
Independent Deployability
Modeled Around a Business Domain
Own Their Own Data
What Advantages Can Microservices Bring?
What Problems Do They Create?
User Interfaces
And Ownership
The Monolith
The Single Process Monolith
The Distributed Monolith
Third-Party Black-Box Systems
Challenges of Monoliths
Advantages of Monoliths
On Coupling and Cohesion
Just Enough Domain-Driven Design
Bounded Context
Mapping Aggregates and Bounded Contexts to Microservices
Further Reading

2. Planning a Migration.
Understanding the Goal
Three Key Questions
Why Might You Choose Microservices?
Improve Team Autonomy
Reduce Time to Market
Scale Cost-Effectively for Load
Improve Robustness
Scale the Number of Developers
Embrace New Technology
When Might Microservices Be a Bad Idea?
Unclear Domain
Customer-Installed and Managed Software
Not Having a Good Reason!
Taking People on the Journey
Changing Organizations
Establishing a Sense of Urgency
Creating the Guiding Coalition
Developing a Vision and Strategy
Communicating the Change Vision
Empowering Employees for Broad-Based Action
Generating Short-Term Wins
Consolidating Gains and Producing More Change
Anchoring New Approaches in the Culture
Importance of Incremental Migration
It’s Production That Counts
Cost of Change
Reversible and Irreversible Decisions
Easier Places to Experiment
So Where Do We Start?
Domain-Driven Design
How Far Do You Have to Go?
Event Storming
Using a Domain Model for Prioritization
A Combined Model
Reorganizing Teams
Shifting Structures
It’s Not One Size Fits All
Making a Change
Changing Skills
How Will You Know if the Transition Is Working?
Having Regular Checkpoints
Quantitative Measures
Qualitative Measures
Avoiding the Sunk Cost Fallacy
Being Open to New Approaches

3. Splitting the Monolith
To Change the Monolith, or Not?
Cut, Copy, or Reimplement?
Refactoring the Monolith
Migration Patterns
Pattern: Strangler Fig Application
How It Works
Where to Use It
Example: HTTP Reverse Proxy
Proxy Options
Changing Protocols
Example: FTP
Example: Message Interception
Other Protocols
Other Examples of the Strangler Fig Pattern
Changing Behavior While Migrating Functionality
Pattern: UI Composition
Example: Page Composition
Example: Widget Composition
Example: Micro Frontends
Where to Use It
Pattern: Branch by Abstraction
How It Works
As a Fallback Mechanism
Where to Use It
Pattern: Parallel Run
Example: Comparing Credit Derivative Pricing
Example: Homegate Listings
Verification Techniques
Using Spies
GitHub Scientist
Dark Launching and Canary Releasing
Where to Use It
Pattern: Decorating Collaborator
Example: Loyalty Program
Where to Use It
Pattern: Change Data Capture
Example: Issuing Loyalty Cards
Implementing Change Data Capture
Where to Use It

4. Decomposing the Database.
Pattern: The Shared Database
Coping Patterns
Where to Use It
But It Can’t Be Done!
Pattern: Database View
The Database as a Public Contract
Views to Present
Where to Use It
Pattern: Database Wrapping Service
Where to Use It
Pattern: Database-as-a-Service Interface
Implementing a Mapping Engine
Compared to Views
Where to Use It
Transferring Ownership
Pattern: Aggregate Exposing Monolith
Pattern: Change Data Ownership
Data Synchronization
Pattern: Synchronize Data in Application
Step 1: Bulk Synchronize Data
Step 2: Synchronize on Write, Read from Old Schema
Step 3: Synchronize on Write, Read from New Schema
Where to Use This Pattern
Where to Use It
Pattern: Tracer Write
Data Synchronization
Example: Orders at Square
Where to Use It
Splitting Apart the Database
Physical Versus Logical Database Separation
Splitting the Database First, or the Code?
Split the Database First
Split the Code First
Split Database and Code Together
So, Which Should I Split First?
Schema Separation Examples
Pattern: Split Table
Where to Use It
Pattern: Move Foreign-Key Relationship to Code
Moving the Join
Data Consistency
Where to Use It
Example: Shared Static Data
ACID Transactions
Still ACID, but Lacking Atomicity?
Two-Phase Commits
Distributed Transactions—Just Say No
Saga Failure Modes
Implementing Sagas
Sagas Versus Distributed Transactions

5. Growing Pains.
More Services, More Pain
Ownership at Scale
How Can This Problem Show Itself?
When Might This Problem Occur?
Potential Solutions
Breaking Changes
How Can This Problem Show Itself?
When Might This Problem Occur?
Potential Solutions
When Might This Problem Occur?
Potential Solutions
Monitoring and Troubleshooting
When Might These Problems Occur?
How Can These Problems Occur?
Potential Solutions
Local Developer Experience
How Can This Problem Show Itself?
When Might This Occur?
Potential Solutions
Running Too Many Things
How Might This Problem Show Itself?
When Might This Problem Occur?
Potential Solutions
End-to-End Testing
How Can This Problem Show Itself?
When Might This Problem Occur?
Potential Solutions
Global Versus Local Optimization
How Can This Problem Show Itself?
When Might This Problem Occur?
Potential Solutions
Robustness and Resiliency
How Can This Problem Show Itself?
When Might This Problem Occur?
Potential Solutions
Orphaned Services
How Can This Problem Show Itself?
When Might This Problem Occur?
Potential Solutions

6. Closing Words.
A. Bibliography.
B. Pattern Index.


We are on the cusp of a revolution in application architecture. According to IDC, by 2022, 90% of all new applications will be based on microservices architectures. As with DevOps, adopting microservices improves agility and flexibility, enabling enterprises to bring their products and services to market faster.

Many enterprises are thinking about migrating their existing apps to microservices-based architectures. But there are many critical questions to ask first. How do you rearchitect an existing system without having to stop all other work on it? How big should a microservice be? When might microservices be a bad idea? What are some of the migration patterns you could adopt when splitting up a monolith?

Monolith to Microservices answers those questions and more. It’s a must-have for application developers and architects, as well as DevOps engineers. Not only does this book provide details about the implementation of microservices, but it also sheds light on the challenges associated with a microservices architecture, and helps you understand if starting this journey is even right for you.

Sam Newman, the author of the O’Reilly bestseller Building Microservices, brings a wealth of experience to guide your path from monolith to microservices in a holistic fashion. He provides in-depth guidance in an incremental and logical manner, from planning to implementation and beyond—how best to manage the growing pains as you scale your microservices.

NGINX can help enable you to achieve enterprise-grade traffic management for your microservices-based applications. NGINX is widely used to manage traffic among microservices, with more than 250 users running more than 3 million NGINX instances in production microservices environments. NGINX is also the most popular Ingress controller for Kubernetes (a container orchestration platform used to deploy and operate microservices), running in 64% of all Kubernetes environments. Additionally, NGINX supports OpenShift, a container application platform from Red

As you embrace microservices, NGINX enables you to achieve enterprise-grade traffic management for your microservices-based applications. We sincerely hope you enjoy this book as you migrate your monolithic applications to distributed applications based on microservices.

What Are Microservices?

Microservices are independently deployable services modeled around a business domain. They communicate with each other via networks, and as an architecture choice offers many options for solving the problems you may face. It follows that a microservice architecture is based on multiple collaborating microservices.
They are a type of service-oriented architecture (SOA), albeit one that is opinionated about how service boundaries should be drawn, and that independent deployability is key. Microservices also have the advantage of being technology agnostic.
From a technology viewpoint, microservices expose the business capabilities that they encapsulate via one or more network endpoints. Microservices communicate with each other via these networks—making them a form of a distributed system. They also encapsulate data storage and retrieval, exposing data, via well-defined interfaces. So databases are hidden inside the service boundary.

About the Author

Sam Newman is a technologist, working for ThoughtWorks. He spends his time helping people build IT systems. Aside from that he commits sporadically to open source projects, has spoken at more than a few conferences, and even found time to write some things.

After spending time at multiple startups and 12 years at ThoughtWorks, Sam Newman is now an independent consultant. Specializing in microservices, cloud, and continuous delivery, Sam helps clients around the world deliver software faster and more reliably through training and consulting.

Sam is an experienced speaker who has spoken at conferences across the world and is the author of Building Microservices from O’Reilly Media.

Reviews about the ebook Monolith to Microservices

  • Sebastian Gebski:
    Sam Newman did it again. He has written a very good ebook on microservices.
    The one which is technology-agnostic & at the same time – very practical.
    What I like most is that Sam doesn’t try to avoid answering uncomfortable questions – e.g. what to do when we have queries spanning across separate storages. Another positive fact is that we’re not getting the 100th description of what is CQRS & Event sourcing. What else? There’s no zealotry, no expressed preferences regarding any particular tools (except Sam’s love towards FaaS ;>), examples presented are good enough (not really deep into the details, but on a sufficient level). What did I miss? Some more explicit statements regarding data redundancy (pragmatism over normalization), helpful conventions (append-only approach & immutability of selected data – this was partially covered in the chapter about deletes).Strongly recommended. Short, but a very decent book.
    P.S. The version I’ve got was sponsored by Nginx (2019.10) – it may differ slightly from the version which will be mass-printed.
  • Robson Castilho:
    I enjoyed this book a lot more than Mr. Newman’s previous Microservices book though it’s still pretty high level. I think he comes across as a very competent and professional Independent Consultant. He doesn’t try and sell anything, he asks the questions most consultants/vendors won’t ask (i.e. Do you need Microservices? Do you need to break up your Monolith? etc)He knows what he’s talking about and he’s confident enough to not feel like he has to sell you anything and he can speak frankly. Very impressive. My main complaint is the one I had for his other book which is there still is no detailed analysis of a Microservice. You still have no idea what one is just from reading this. Admittedly though this isn’t meant to be a Microservices book as much as a Monolith to Microservice book. But, having said that, it would have been fantastic to use a real or contrived Monolith example and break it down (in detail) to microservices. I’m sure that would double the book size, but it would be real concrete information.
  • Max Wolffe:
    Overall I found this book to be an excellent, practical guide to approaching a monolith decomposition, though I have a few issues with it. The Good:
    – Newman starts by presenting all of the reasons why you might want to do microservices and how you could solve them WITHOUT doing microservices. This was the main complaint with “Building Microservices” which presents microservices without being too critical about when one would want to avoid microservices.
    – There’s a great section describing how one might help their organization to make a change to microservices. This section builds nicely on Newman’s second chapter of “Building Microservices”, “The Evolutionary Architect”.
    – There are some good decomposition patterns, notably: branch by abstraction and the strangler fig pattern.
    – There is an EXCELLENT section on the growing pains one might encounter when they start adopting microservices. I found this section to be particularly useful because it’s leveraging Newman’s considerable experience as a consultant, in which he’s seen lots of different companies adopt microservices and encounter problems.
    – Newman focuses on core, long-lived aspects of migrations instead of on specific technologies (which will be outdated in a year), with just enough technology examples to help one connect concepts to real-world examples. The Not So Good:
    – The actual decomposition recommendations almost entirely ignore the issues brought up in the “Growing Pains” chapter. One huge issue that microservices bring up is that network calls have a different guarantee than databases: they may fail, they aren’t transactional, they may timeout, etc. This causes big problems with two proposals in the book:
    – Dual write migrations – A migration strategy in which one writes to both systems using rest calls, migrates data, and then changes reads to the new source of truth. The big issue with this strategy is keeping both stores consistent since calls to either system can fail or time out. In my experience, this is one of the hardest parts of migrations, and it’s barely handled as written. I would have loved to see more examples of how companies handled this, from Newman’s experience.
    – Orchestrated Sagas – A similar issue arises in Orchestrated Sagas. There may be partial failures on any part of the way with both the inbound saga and the “compensating transaction”. The book suggests using choreographed transactions where possible but doesn’t bring up this danger of orchestrated transactions.I’m wondering if it would have been better to restructure the book to first present the unique issues which microservice architectures encounter and then present decomposition techniques that lead to architectures that are resilient to these issues.
    – The decomposition examples given are pretty straightforward. This is probably to make the points very clear, but it would have been great to have at least one example of a decomposition that was tricky or which wasn’t worth decomposing at all. Newman mentions that such examples exist, but doesn’t do any further examination.Overall:
    Overall, a very practical guide to migrating from a monolith to microservices, and (importantly) why you might not want to.
  • David Van Couvering:
    I loved Sam’s other book on microservices, but this one addresses the key issue – you almost never build microservices from scratch. The last three companies I have worked at have all had monoliths they were trying to move off of, and even after deciding a microservice architecture was the right choice, the big problem was how to get off of the old one. And the biggest challenge, by far, is the data. This is where Mr. Newman’s book shines – he has so many different smart and useful patterns for addressing data migration. I am putting them to use already. Highly recommended if you find yourself staring at this big ball of mud and feeling completely overwhelmed. This book will give you courage and prevent you from crawling into a corner and pulling a blanket over your head.
  • Jakub:
    What I liked the most about the ebook is that is short and dense. It has everything in the proper amount of length, giving a good overview of the problems, and provide some of the possible solutions to them with a bit of “what I would do”.Really good book.
  • Adnan:
    It is an amazing book. It covers everything from start to end. If you want to travel the road of Microservices. It’s structured in a way that fits the mental model of monolith developers but to evaluate Microservices architecture. It’s going to serve as a glossary of what to do & what not to do when doing Microservices. Starts with simple 3 questions, during the journey you would feel yeah it feels very real. But without a single line of code. You will get answers along the way, from people problems, team ownership, tackling database, the importance of DDD, and suggestions on tools one have to learn along the way. Thanks, Sam Newman for writing such an amazing ebook.
  • Victor:
    Practical advice on how to move to Microservices. It also discusses the reasons you would want to migrate your app to a Microservices architectural style and even gives alternatives that might help you achieve the same goal without migrating. I liked the realistic examples, trade-off analysis. I enjoyed Chapter 4, on Decomposing the Database the most, because I think that’s probably the hardest part when migrating to Microservices (and the one that gets the least amount of coverage in many resources). The patterns cover problems we’ve all seen in the wild and the solutions are pragmatic and useful.
  • Fernando Aguilar:
    Superbly explained. Quick to go to the facts. I understand now this very important subject that has been in the news so much.
  • Denis Romanovsky:
    A nice book with lots of recipes, patterns, and best practices for breaking monoliths into microservices. Not too detailed into tech stuff, but still good enough.
  • Ben Twain:
    Helpful ideas and patterns. Would have liked more prescriptive advice about the patterns and how to apply them.
  • Vinayak Hegde:
    A well-written book on the different problems that you are likely to encounter when migrating from a monolith to a distributed systems microservices architecture. The book is neatly divided into different parts that cover different technical and non0technical aspects of making the move such as figuring out if microservices architecture is the right path for you (Chapter 1), getting the right team and team structure in place, and also management buy-ins (Chapter 2), breaking down code and migrating using different patterns to reduce coupling (Chapter 3), migrating and breaking down datastore and database schemas and patterns to do this (Chapter 4), The likely problems that you will encounter when undergoing the migration (Chapter 5).I like the fact that the book looks at the migration path holistically liberally talking about different kinds of tools, techniques, and further reading references. I have done such migrations in the past in my career but I learned a lot in this book (even if it was the name for the patterns I implemented). The version that I read was sponsored by Ngnix so it might be slightly different from the commercial book.
  • Andreas:
    Good introductory to transforming a monolith into a microservices-based system. It lays out the main ideas nicely. However, it’s a bit naive and doesn’t touch on real-world systems which are way more complex.
  • Bartłomiej Falkowski:
    It’s so hard to write a good book about software architecture. I think you have two options: digging deeply into the technical details or trying to be technologically agnostic and relying only on “abstractions”. This book is of the latter type – the word “Docker” is used only once and the word “Kubernetes” is used less than five times 🙂 And this is a really good book. What I liked:
    – Simplicity. All the patterns short and well explained. Moreover, we always have a context of usage – it’s easier to put it in the “real-life” scenario.
    – Pragmatism. I like the idea of a slider instead of a button for the description of making changes. Nothing is for free and we should always look at architecture migration in this way. What I didn’t like:
    – The shallowness of some topics. For example, the phrase “extract your services based on bounded contexts” is in self a topic for multiple books. However, I understand that exploring such problems in this book would increase the number of pages dramatically 🙂 I accept it.
  • Juan Moreno:
    El contenido aborda los problemas que surgen al dividir un monolito en microservicios desde el punto de vista de la arquitectura, y no desde una tecnología en concreto.
  • Saran Sivashanmugam:
    Another great microservices book from Sam Newman. I felt this is a sequel to his earlier book, Building Microservices. Sam updated some concepts from recent microservices evolution such as choreographed vs orchestrated Sagas, added infrastructure evolution such as Kubernetes. I loved the depth he covered the monolith database refactoring and the simple but elegant solutions he proposed using schemas and views in the existing database engine for refactoring. I’m a fan of Sam’s pragmatic approach when introducing new concepts that work very well for startups and big corporations. He also delved into details about the organizational aspects of microservices and the distributed systems concerns that microservices might bring. If you liked reading his earlier book Building Microservices, then this is a highly recommended sequel helping in implementing that.
  • Sabino:
    Must have read.
  • Adnan Rafiq:
    It is an amazing book. It covers everything from start to end. If you want to travel the road of Microservices. It’s structured in a way that fits the mental model of monolith developers but to evaluate Microservices architecture. It’s going to serve as a glossary of what to do & what not to do when doing Microservices. Starts with simple 3 questions, during the journey you would feel yeah it feels very real. But without a single line of code. You will get answers along the way, from people problems, team ownership, tackling databases, the importance of DDD, and suggestions on tools one has to learn along the way. Thanks, Sam Newman for writing such an amazing book.
  • Felipe Henrique Gross Windmoller:
    This ebook teaches us many strategies to make a successful migration to microservices. I recommend it for those that will work with this.
  • Fermin Quant:
    A very well-written book, which shows on every page the experience of the author on the topic. It really puts into perspective the huge task of moving to microservices from a monolith, the most common pitfalls, and provides possible solutions to them.
    The book is most useful as a reference for your journey of moving to microservices, it is not an absolute proven guide of not failing, but more a collection of very well-organized experiences that will help you avoid most common problems and kind of guide your decision making.
    It is good that the author emphasizes at the start that microservices are not for every situation, and spends some time explaining how you can figure this out for your current situation before you start.
  • Bradley:
    I previously read Building Microservices by Sam Newman which was great staying off point for Microservices. This book expands on that by including strategies to migrate from a monolith to microservices. The strategies are well explained and practical examples given to solidify the learning. Sam’s way of teaching keeps things interesting while reinforcing the information. I can’t recommend this enough for anyone planning to migrate from a monolith to microservices.
  • Lazar Danilov:
    Honestly, in the past years, I have read a lot of titles about microservices architecture but this one turned out to be actually useful for me and my job. For the last two years, I was desperately trying to get rid of monolithic structured applications and this book gave me the best approaches to do that! It is fairly simple but really practical and useful! Congrats to Newman! Although there were many things I already knew, there were also some observations and simple advice that can definitely change your workflow whenever you are facing such issues.
  • Rafael Gorski:
    This a review of the first chapter of the book… I like the written approach/style of the book. It initiates from core concepts of coupling and cohesion which are the core principle and linked well with microservices decompositions and common scenarios. Thoughts for an extension for the book:
    I thought this chapter one is a good link to the requirements phase. The requirements being decomposed in the same way as a pre-design phase to then prepare for microservices design.
  • Tom:
    Good, very practical review of the thought processes and real-world symptoms and consequences when considering a move to microservices. You’ll need to think for this one, as the author doesn’t hand you the answers, but if you do think through this material, you’ll be equipped for the squishy world of actual professional software development.
  • Ibrahim Tasyurt:
    I loved this book. The author puts together the challenges&opportunities when transforming monolith to micro-services. Also compiles the patterns to migrate the code and data. The patterns described in this book are not only applicable to microservices transformation but any kind of re-write and migration cases.
  • Isaac Perez Moncho:
    Very good book, if you are thinking about microservices you must read it.
    It explains the different ways you can migrate from a monolith to microservices, but also tries to explain how to understand if this move is right for you.
    A brief summary would be: “strangler patter” and it’s not easy.
  • Bart Schotten:
    Very practical and realistic. Not just a rehash of its predecessor.

Buy more ebooks

Building Microservices: Designing Fine-Grained Systems 1st Edition

Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems

System Design Interview An insider’s guide 2nd Edition


Sam Newman







ISBN 13:



O'Reilly Media

ISBN 10:






Digital delivery:

Via Email


There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

%d bloggers like this: