Refactoring a monolith to microservices
Truly greenfield development of microservices-based applications is relatively rare. Many organizations that want to adopt microservices already have a monolithic application. As I describe in chapter 13 of my book, the recommended approach is to use the Strangler application pattern and incrementally migrate function from the monolith into services.
Presentations on refactoring
These presentations are good overviews:
- Considering Migrating a Monolith to Microservices? A Dark Energy, Dark Matter Perspective
- DevNexus 2020
- Oracle Code One 2019 talk
- Six principles for refactoring a monolith to microservices
- Ten principles for refactoring a monolith to microservices - an expanded version of the six principle talk. Sadly, there was a glitch at the start of the talk that messed up the beginning of the talk.
About the FTGO monolith
The FTGO monolith (see source code) is the monolithic version of the microservices-based FTGO application. Its goal is to demonstrate how to refactor a monolithic application into services using the Strangler pattern. It’s used as an example in both my book and in my presentations about refactoring.
Refactoring strategies
Chapter 13 of my book describes how to refactor a monolith to microservices. There are two main refactoring strategies:
- Implement new functionality as services
- Extract services from the monolith
Let’s look at each one.
Implement new functionality as services
A good way to begin the migration to microservices is to implement significant new functionality as services. This is sometimes easier than breaking apart of the monolith. It also demonstrates to the business that using microservices significantly accelerates software delivery.
Extract services from the monolith
While implementing new functionality as services is extremely useful, the only way of eliminating the monolith is to incrementally extract modules out of the monolith and convert them into services. Here is an example of extracting a service from a monolith.
Signup to get notified
Signup to get notified when more content is added to this page.