Monolithic Vs Microservice Architecture

Introduction

 
Nowadays Microservice architecture is trending. So many developers prefer this architecture as it is easy to extend and easy for scalability.
 
But it doesn’t mean that monolithic has drawbacks. Monolithic is good in its place. To explain Microservice in a good way I choose Monolithic for comparison to make it easy to understand.
 
It is up to developers/Architects wisdom to choose the right architecture for the project which they are working on. 
 
We will see with an example.
 
Requirement: Provide student service from which the user will be able to add, update, get, and delete student’s records.
 

Monolithic Architecture

 
As the name suggests here, it's mono. All application layers will be available in single/mono package
 
For students, all required services, database, interfaces will be in a single package like in the below image
 
 
For easy understanding I am just highlighting the service and database. So in real-time projects, the  User Interface, Business Logic, DAL (Data Access Layer), and Database will come into the picture.
 

Microservice Architecture

  • It is a service-oriented architecture. This service breaks into microservices so that it will be easy to extend
  • If updates need to be done in the existing service in the future it will easy to update and test.
  • As service was a break at the micro-level, the probability of code reusability will be more.
Below is the high-level diagram of Microservice architecture
 
 
As per the above diagram, we can see that all 4 functionalities are broken into different services. And each service is communicating to different instances of the same DB. So don’t confuse with 4 DBs. Here 4 DB’s referred to as 4 instances of the same database.
 

Summary

 
I tried to explain Monolithic and Microservice in a simple way, and I hope it is easy to understand. For detailed architecture, I will post an article in the future for both Monolithic and Microservice.


Similar Articles