Microservice is a service-based application development methodology. In Microservice large applications get divided into small independent service units. Service-oriented Architecture (SOA) is implemented by a process called Microservice. This creates a collection of interconnected services, each service serves one business logic.
Keep in mind the following rules while developing a Microservice-oriented application.
1. Independent − Each microservice should be independently deployable.
2. Coupling − Microservices should be loosely coupled if we make changes in one application then the other should not affect.
3. Business Goal - Each Microservice should deliver one specific business goal.
Fig 1. Microservice Architecture
1. Small in size − Microservice is designed in such a way that it will only perform one business task, which makes it small in size as compared to a monolithic application.
2. Autonomous − Each microservice should be an autonomous business unit of the entire application. That makes it a loosely coupled application and also reduce the maintenance cost.
3. Technology heterogeneity − We can build one Microservice in different technology and another in different technology. Finally, we got a heterogeneous system, that is highly secured, scalable and robust system.
4. Resilience − Resilience is the property of isolating a software unit. Microservice follows a high level of resilience whenever one unit fails it does not impact the entire business.
5. Ease of deployment − In Microservice every component itself is a full stack in nature. So we can deploy multiple changes in any environment very easily with less time complexity unlike other monolithic applications of the same kind.
Disadvantages of Microservice
1. Distributed system − Mostly different technologies are used to develop different parts of a microservice. That required skilled professionals to support this big heterogeneous distributed software. Hence, distribution and heterogeneity are one of the disadvantages of using microservice.
2. Cost − Microservice is costly because we have to maintain different server spaces for the different business units to perform business tasks.
3. Communication between Services is Complex − As every unit is independent of the other, we have to manage the request traveling between services. Overtime complications arise when remote calls experience latency.
List of Principles that need to be taken care of while developing a microservice.
1. High Cohesion − Business logic need to be sub-divided into the smallest business unit as much as possible.
2. Independent − All the services should be full stack in nature and independent of each other.
3. Business Domain Centric − Software will modularize according to the business unit and is not tier-based.
4. Automation − Testing deployment will be automated. Try to introduce minimal human interaction.
5. Observable − Each service will be full stack in nature and they should be independently deployable and observable like an enterprise application.
Conclusion: In this article, we covered the architecture design of Microservice, its advantages & disadvantages. Also, cover the Principles to be followed while developing the Microservice.
Thanks for Reading !!!