Monolithic & Microservices Architecture.
This article is about the architecture that most software developers follow in order to build their projects.
In order to understand microservices, we need to understand what are monolithic applications and what led us to move from monolithic applications to microservices in recent times.
Monolithic Architure:
Before microservices, a monolithic architecture was the standard. All components were a part of a single unit. In one code-base i.e., Everything developed, deployed and scaled as a single unit.
App's were written with 1 tech stack. Teams needed to be careful to not affect each other's work. One single artifact, so developers must redeploy the entire application on each update.
Challenges it faced:
- Apps were too large and complex so parts were more tangled into each other.
- The entire app needed to be scaled, instead of a specific service.
- Higher infrastructure cost along with longer release processes.
- On every change, the entire app needed to be built, deployed & tested.
- Bug in any module could potentially bring down the entire app.
Microservices Architecture:
Here comes microservices architecture,
It split apps into smaller independent services. Splits were based on business functionalities rather than tech functionalities as each service needed to be self-contained & independent. Services were build and deployed separately.
Communication between microservices:
- Using API calls. Each service has it's own API, that can talk to each other.
- Using Message Broker. Some common distribution patters are Publish/ Subscribe & P2P messaging.
- Using Service Mesh (in field of Kubernetes).
Challenges it faced:
Added complexity just by the fact that a microservice application is a distributed system.
- To configure communication between services.
- More difficult to monitor with multiple instances of each service distributed across servers.
Conclusion:
Microservice Architecture is an architectural style that provides a number of benefits by adopting a divide and conquer approach to software design and deployment. Microservices can be individually maintained, isolated, scaled up or down, or upgraded and replaced. The modularity of microservices can affect both the requirements and the benefits of the deployment. The best solution is not universal and entirely depends on the client environment and application requirements.