Monolithic to Microservices
Learn about the structure and functions of monolithic applications, the benefits of moving to microservices, and strategies for the shift.
Join the DZone community and get the full member experience.Join For Free
What Are Monolithic Applications?
This kind of application is not responsible for a single task, but they need several tasks to complete a particular responsibility. In monolithic applications, all the services are bundled into one package and run as one process. The user interface, data access layer, and data store layers are tightly coupled in monolithic applications. Usually, large teams work with monolithic applications, and they are not suitable for container-based deployments.
- Monolithic applications are very simple to develop because of all the tools and IDEs support to that kind of application by default.
- Very easy to deploy because all components are packed into one bundle.
- Easy to scale the whole application.
- Very difficult to understand and create the patches for monolithic applications.
- Adapting to new technology is very challengeable.
- Very difficult to maintain CI/CD pipeline.
- Maintainability is very high and braking of one code line will stop the whole process.
- Take a long time to startup because all the components need to get started.
- One component failure will cause the whole system to fail.
What Are the Microservices?
There is no proper definition for the microservices. We can define the microservices as a bunch of loosely coupled components working together to perform tasks. These light weighted components can be developed through various languages (Java, PHP, Python) and can use various protocols (Http/Https/JMS) to communicate between two components. Most of the microservices expose their services through the REST APIs so that other services can call those services very easier. Microservices follow the decentralized architecture.
- Can use the latest technologies to develop the microservices.
- Composability is very high.
- Can scale independent microservices separately. No need to scale the whole the system.
- One component failure will not cause entire system downtimes.
- When developing an overall solution we can parallel the microservices development task with the small teams. So it helps to decrease the development time.
- CI/CD is very easy.
- Independent code base maintenance is very difficult.
- Monitoring the overall system is very challenging because of decentralization. Communication needs to be very strong to communicate with independent modules.
- Has additional performance overhead because of network latency.
Why Do You Need to Move?
Nowadays most of the enterprise applications move into the microservice based architecture to get the maximum business value. Most people are looking for new technologies and also are looking to move out of legacy systems. People tend to use integration rather than developing whole applications like monolithic. "People like to live in green fields, not in brown fields."
Key Points to Be Considered for the Transition
- Identify the components which are capable of running independently.
- What are the technologies you use to develop the microservices?
- Need to think about the independent service code maintainability.
- Need to consider the infrastructure and the how you are going to load balance between each component because these services are independently deployed.
- Need to consider how many teams are going to develop the servers and number of members in one team. (Team size = two pizza)
Ice Cream Scoop Strategy
Using this kind of strategy organization can gradually move monolithic architecture to the microservices architecture. This strategy mainly focuses on the system uptime, user experiences and can run both systems in parallel. Get one component form the monolithic application and develop it as a microservice then put it into production. Likewise scooping out all components and smoothly migrate to microservices. This strategy reduces the migration risk with the transition. Using this kind of strategy will take longer to migrate whole the system into microservice architecture.
In this strategy, organizations are not going to completely remove the monolithic application. What architects do is to develop new features as microservices and keep the existing monolithic application as it is. This kind of architecture is called hybrid architecture. Disadvantages of this strategy are that it is required to maintain the legacy system as well as the microservices and system integration is very hard. The plus point of this strategy is that it can reduce the workload and features can be developed within short time periods.
Nuclear Bomb Strategy
The entire monolithic application is written using the microservices form the scratch. The main advantage of this strategy is that the organization can overcome all the bugs in the monolithic application, can choose whatever technology for the new building microservices and also can engage new features than the monolithic application. For this strategy, the organization needs to put more effort and more investments.
Opinions expressed by DZone contributors are their own.