Your legacy application may have a monolithic architecture. In Chapter 8, Architecting Modern Applications, we learned that a monolithic application is designed to work as a single, self-contained unit. The code may have components that are tightly coupled and highly interdependent. If the application is large and complicated, it can be difficult to make changes to a monolithic application.
One approach to modernizing a legacy application is to begin introducing microservices. Microservices are small, focused, autonomous services that are independently deployable. Unlike a monolithic application, the microservice approach reduces the level of complexity by partitioning an application into small services that are easier to maintain and manage. In a legacy application, we can take pieces of logic and place them in microservices.
Places in the legacy application that need the functionality contained in a microservice can interact with it through its interface. Implementations of each service can be changed as long as the interface remains the same. It also provides the ability for a development team to modify a microservice independently of other services. In contrast with modifications made to a monolithic application, changes to individual microservices are less likely to require modifications in other places in the application.
There is better fault tolerance with microservices. If a legacy application has a monolithic architecture, a fault could bring down a large part of the application or even the entire application. When a single microservice fails, it will not cause the entire application to crash. Combined with proper monitoring, which will alert administrators to a fault quickly, a microservice can be restarted quickly. If there is an issue with the currently deployed version of a microservice, a new version that contains a fix can be deployed without having to deploy the entire application. It also provides the option of reverting to a prior version of the microservice if it does not contain the issue.