Upgrading from a monolithic architecture to microservices is essentially to continually replace parts of the old application with new microservices. While this section talks about upgrading a monolith, it can also be taken as a planning step for an entirely new application. You will see how to conceptually upgrade a monolith to microservices; there is no code mentioned at this point because you will see this in much more depth later in this book. You should, however, see the concept underneath after reading this section.
They may not fit your specific application but are generally widespread among monolithic applications. This approach is referred to as Model-View-Controller (MVC). The components of this approach are defined as follows:
- A Model represents an instance of a data type, for example, User, Product, and Order.
- A Controller represents a logic executor that typically takes input in and returns the output in the form of serialized models, for example, UserController, OrderController, and ProductController.
- A View represents an output from the controllers, often either HTML, XML, or JSON.
Many current web technologies are built on top of the MVC concept, such as the following:
- PHP (Laravel, Symfony, and Zend Framework)
- Ruby (Ruby on Rails)
- Java (Spring MVC and Vaadin)
- Go (Revel and Iris)
- Python (Django)
- Swift (Vapor, Kitura, and Perfect)
The goal is now to convert an MVC application into a microservice application.
Let's go through the following sections:
- Decoupling business logic
- Reorganizing your monolith
- Integrating microservices
We start by decoupling business logic.