Microservice architecture defines the software design model where independently deployed services working and communicates each other a via well-defined mechanism to achieve a larger business goal.
In contrast monolithic architectural style defines the application built as a single entity & autonomous unit. Where single server-side layer handles the Http request, apply business logic to single data layer interaction.
Challenges with monolithic architecture is that each new enhancement or feature addition leads to the new version of the application which increases the business risk and also makes the development process slower due to tight coupling with other layers. The function of an application can not be scale so easily. This is where microservices made entry.
Benefits of Microservice architecture:
- Rapid Development: Multiple development teams works independently in parallel which reduces the development lifecycle and increases the frequency of deployments.
- Multiple technologies stack: Each team can develop the service on the choice of language and platforms.
- Scalability: Each service can be evolved separately with an addition of features. Easy to integrate with third party services.
- Reduce the business risk: Single service deployment reduces the risk of the entire business.
- Version Control: Code is in well-defined structure based on the criteria of features.
- System resilience: System resilience: If any of the services stops working it affects the small feature of the application. Unlike in the monolith model, entire business jeopardized if anything goes wrong.
Trade-Offs:
- Testing Efforts Increases: Due to distributed system working cross functional, scope of testing increase to unit, component, integration levels.
- Difficult to find failure
- Operational Overhead: Need to deploy & manage multiple services running.Need highly robust automated deployment process. Due to more memory consumption disk management is another operational task.
- Infrastructure Provisioning: It takes a time to get multiple setups ready for deployment,it increase the infrastructure cost and time.
- Distributed System Complexity: Multiple remote procedure calls, Http calls, network layers increase the issue of network latency, fault tolerance, security concerns.
Conclusion:
I am a big fan of microservices. Still, I believe it’s more challenging during the early phase of building microservices. Benefits are amazing but it comes with the cost.