Monolith to Microservices: Evolutionary Patterns to Transform Your Monolith
Evolutionary Patterns to Transform Your Monolith
Distributed systems have become more fine-grained in the past 10 years, shifting from code-heavy monolithic applications to smaller, self-contained microservices. But developing these systems brings its own set of headaches. With lots of examples and practical advice, this book takes a holistic view of the topics that system architects and administrators must consider when building, managing, and evolving microservice architectures.
I really appreciated Sam Newman’s work in Building Microservices Designing Fine-Grained Systems and learned a lot from it and it had a profound effect on the way I view, think about and develop microservices. If you’re new to microservices or even if you’re a seasoned microservices developer I’m sure you find the book extremely useful and relevant, despite it first being published in 2015.
I was excited to discover that Newman had followed that work up with this book. The reality is for most developers the chances are rare that you’ll be working on a Greenfield project and implementing a Microservice architecture. Your most likely project you’ll be engaged in is an Application Modernisation project with a lot of Technical Debt which may hamper the scaling of the application effectively.
This is where this book shines, because it defines several patterns and approaches to take when engaged in such a project. Evolutionary Patterns to Transform your Monolith – is an appraisal of the challenges associated with microservice architecture to help you understand whether starting this journey is the most appropriate solution.
What I like about this book
The book covers a number of topics to consider when transforming a monolith to a microservice architecture from domain-driven design to the organisational change model – vital underpinnings that will stand you in good stead to understand and mitigate the risks.
Just like his previous work, Newman has managed to achieve writing a very practical and technological relevant book, while at the same time remaining completely technology and platform agnostic.
It builds upon the foundations of Domain Driven Design, CQRS and Event Sourcing and starts by presenting all of the reasons why you might want to do microservices and how you could solve them without having to implement a complete microservices architecture. Which is important and probably a shortcoming of Building Microservices which may present microservices without being to critical about when to use and when to avoid.
For all the benefits that Microservices provide, implementing a Microservice Architecture adds a lot more complexity to your application architecture and if you don’t know what you’re doing you can get into trouble really quickly. Many organisations may be transitioning to a Microservices Architecture due to an Application Modernisation project or a Digital Transformation programme being implemented, in a lot of cases they maybe transitioning to Microservice Architecture after a successful MVP experiment during their Product Development road map
The book has an excellent section describing how to help an organisation to migrate to microservices. Which actually adds more detail to the second chapter of “Building Microservices”, “The Evolutionary Architect”. There are some good decomposition patterns, notably: branch by abstraction and the strangler pattern.
There is also a great section on the growing pains you can expect to encounter when 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.
What I learned from this book
One of the most difficult and often overlooked aspect of migrating to microservices to the is the decomposition of databases. The book discusses several patterns to cover problems seen in the wild and the solutions are pragmatic and very useful.
The core of the book present a catalogue of high-level patterns that can be used to split a monolith both from the serviceâ€™s perspective and from the databaseâ€™s perspective. The solutions presented are for common problems that are explained at different levels of detail: some involve fiddling with networking and infrastructure, others modifying service code via refactoring, and others propose changes in the database or its tables.
Several of the patterns may feel intuitive but it is comforting to know they are patterns and methodology to encourage incremental, evolutionary changes in architecture while offering multiple alternatives; occasionally Newman highlights his preference for one over the other but heâ€™s emphatic that it depends on the context of each problem, like a true consultant!.
A couple of the patterns present somewhat surprising solutions, away from dogmatism’s and the tyranny of batch processing and monolithic databases, making a good case for event-based microservice architectures.
Why I recommend this book
As a developer, it is very easy to get your judgement clouded by reading and engaging in the myriad and plethora of content available online relating to microservices. For me personally, it is always important to take a step back from the noise and read material offline, and this is another highly relevant example.
The book doesn’t try persuade you to use some new tool or miracle framework, instead it breaks the problems down and provides practical solutions to them without getting lost in the technology and low level details.