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.
These presentations are good overviews:
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 Stranger pattern. It’s used as an example in both my book and in my presentations about refactoring.
Chapter 13 of my book describes how to refactor a monolith to microservices. There are two main refactoring strategies:
Let’s look at each one.
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.
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.
For example, let’s imagine that the FTGO team wants to improve the efficiency of the business and customer satisfaction by rapidly iterating on the courier scheduling algorithm.
It will be a lot easier for them to work on the delivery management logic if it’s a separate Delivery Service
.
To do that, the FTGO team must separate delivery management from order management and convert it into service.
Extracting the Delivery Service
consists of the following the steps:
Delivery Service
Delivery Service
Before looking at each of these steps, let’s first review the AS-IS code.
In the FTGO monolithic application, Order management
and Delivery management
are intertwined as shown in this diagram.
Read more about the AS-IS architecture.
The first step is to split the code and convert delivery management into a separate, loosely coupled module within the monolith.
Read more about how the code is split.
The second step is split the database and define a separate database schema for the ftgo-delivery-service
module.
Read more about splitting the database.
Delivery Service
The third step of the refactoring process is to define a standalone Delivery Service
and deploy it.
The service does not, however, handle production traffic.
Instead, it can, for example, be tested in production.
Read more about defining standalone Delivery Service
.
Delivery Service
The fourth step of the refactoring process is to use the standalone Delivery Service
.
Read more about how to route production traffic to the Delivery Service
.
The fifth step of the refactoring process is to remove the now obsolete delivery management logic from the monolith.
Read more about removing the obsolete code.
Signup to get notified when more content is added to this page.
Microservices.io is brought to you by Chris Richardson. Experienced software architect, author of POJOs in Action, the creator of the original CloudFoundry.com, and the author of Microservices patterns.
Chris helps clients around the world adopt the microservice architecture through consulting engagements, and training workshops.
Chris teaches comprehensive workshops for architects and developers that will enable your organization use microservices effectively.
Avoid the pitfalls of adopting microservices and learn essential topics, such as service decomposition and design and how to refactor a monolith to microservices.
Learn moreChris offers numerous other resources for learning the microservice architecture.
Want to see an example? Check out Chris Richardson's example applications. See code
Got a specific microservice architecture-related question? For example:
Consider signing up for a two hour, highly focussed, consulting session.
My virtual bootcamp, distributed data patterns in a microservice architecture, is now open for enrollment!
It covers the key distributed data management patterns including Saga, API Composition, and CQRS.
It consists of video lectures, code labs, and a weekly ask-me-anything video conference repeated in multiple timezones.
The regular price is $395/person but use coupon MECNPWNR to sign up for $120 (valid until May 16th, 2023). There are deeper discounts for buying multiple seats.
Take a look at my Manning LiveProject that teaches you how to develop a service template and microservice chassis.
Engage Chris to create a microservices adoption roadmap and help you define your microservice architecture,
Use the Eventuate.io platform to tackle distributed data management challenges in your microservices architecture.
Eventuate is Chris's latest startup. It makes it easy to use the Saga pattern to manage transactions and the CQRS pattern to implement queries.
Engage Chris to conduct an architectural assessment.
Note: tagging is work-in-process
anti-patterns · application api · application architecture · architecting · architecture documentation · assemblage · beer · containers · dark energy and dark matter · deployment · design-time coupling · development · devops · docker · eventuate platform · glossary · hexagonal architecture · implementing commands · implementing queries · inter-service communication · kubernetes · loose coupling · microservice architecture · microservice chassis · microservices adoption · microservicesio updates · multi-architecture docker images · observability · pattern · refactoring to microservices · resilience · sagas · security · service api · service collaboration · service design · service discovery · service granularity · service template · software delivery metrics · success triangle · tacos · team topologies · transaction management · transactional messaging