Most of us have heard the term microservice. In this article we are going to learn what microservice is, the existing architecture we are using, the problem in the existing architecture, and the advantages of microservice.
What is Microservice?
Microservice is a new architectural style. A collection of small services forms an architecture called microservice architecture. Each and every service has its own business logic deployed independently and may run independently. In the microservice architecture, the services communicate through the API only.
The basic idea of microservice is to split the application into small services and run them independently.
Diagram
Why Microservice?
- Faster than monolithic architecture
- If one of the services fails another will run
- No need to take down the entire application for the deployment
- Technology Independent (i.e. front end may be developed in angular and the backend service may developed in .net or any other technology.)
Existing Architecture?
Most of the companies/developers use Monolithic Architecture. Monolithic Architecture is single-tier architecture, which means all the backend logic and the frontends are in a single environment.
Diagram
Problems in Monolithic Architecture
- It may slow down the application when the application size increases.
- Need to take down the entire application during the deployment.
- The developer may have difficulty in continuous deployment.
- If a small piece of code changes in the application the developer needs to redeploy the entire application.
- Monolithic application is tightly coupled.
Advantages in Microservice
- Independent deployment. So there is no need to take down the entire application.
- If any one of the services fails another one will run without any issue.
- The service may be written in different languages.
- It enables continuous delivery.
- Increase application performance.
- Dockerization and containerization are possible.
- The service may run on different servers.
I hope this article may help you to understand the basic idea of Microservice architecture.
Learn more here: Build Microservices using ASP.NET Core