This post is inspired by my previous experience of migrating apps from monolith to microservices, hoops I have to jump and hours I spent researching this topic on the web.
A common approach is to start with a monolith and gradually peel off microservices at the edges. Such an approach can leave a substantial monolith at the heart of the microservices architecture, but with most new development occurring in the microservices while the monolith is relatively still. Picture below illustrates this concept effectively:
Few tips which will help you in this journey:
- Things should be done via small, incremental changes
- Adequate test coverage to validate these changes
- Make sure that we still have a working product after every round of change
- Identify services boundaries inside Monolith app, which later on could be externalized to standalone service.
- Microservices communication: understand when to use service-to-service communication(TCP/UPD, HTTP, gRPC) patterns as opposed to asynchronous patterns(Apache Kafka, RabbitMQ, etc).
- Most probably you will need 2 teams, one for supporting old code base and one for building a new one.
- Be very cautious about which interfaces, classes, libraries, etc goes to “common” modules and shared across numerous microservices. As you may end up in different microservices will need to use a different version of the same library.
- Don’t forget about SOLID principles
More info on that:
Martin Fowler’s blog
Building Microservices: Designing Fine-Grained Systems