Monolithic vs MicroServices vs Micro Frontends

Monolithic vs MicroServices vs Micro Frontends

Overview

In this article, We will be looking at different approaches of software development

  • Monolithic
  • MicroServices
  • Micro Frontends

Monolithic

Monolithic application describes a single-tiered software application in which the user interface and data access code are combined into a single program from a single platform.

In simple words, If all the functionalities of a project exists in a single codebase, then that application is known as monolithic application. We all developed monolith applications in our career.

To explain about monolithic application in detail, we will take example of travel product as follows:

  • Application UI/ Frontend — responsible for handling HTTP requests and responding with HTML on browser.
  • Business layer — the application’s business logic. This business layer consists of all the travel features like Flight Integration, Hotel Integration, Car Integration and Payment Integration. This makes code difficult to understand and maintain
    `- Database — Single Database for entire application to store data

Refer below diagram for your reference:



Advantages

  • Simple to develop, test and deploy
  • Simple to scale horizontally by running multiple copies behind a load balancer.
  • Less problems of network latency and security

Disadvantages

  • Maintenance — If Application is too large and complex to understand entirely, it is challenging to make changes fast and correctly.
  • We need to redeploy the whole application even for a small change. It also increases cost of development and testing.
  • As the size of the application increases, its start-up and deployment time also increases.
  • For any new developer, it is very difficult to understand the logic of large Monolithic application even if his responsibility is related to a single functionality.
  • It is not very reliable as a single bug in any module can bring down the whole application.
  • Monolithic applications have difficulty in adopting new and advance technologies.

MicroServices

Microservice architecture - is an architectural style that structures an application as a collection of services.

In other words, Application that is made up of smaller services communicating with each other directly using light weight protocols like HTTP. Instead of sharing a single database with other microservices, each microservice has its own database as it ensures loose coupling.

To understand better, we will discuss about same example that we talked in monolithic.

  • Application UI/ Frontend — responsible for handling HTTP requests and responding with HTML on browser.
  • Business layer — the application’s business logic. In microservices architecture, we have created small services for each feature like flight, hotel, car and payment microservice. Now this business layer is easy to maintain.
  • Database — Single Database for entire application to store data

Refer below diagram for your reference:


Advantages

  • Maintenance It is easy to manage as it is relatively smaller in size.
  • If there’s any update in one of the microservices, then we need to redeploy only that microservice. Hence, their start-up and deployment time are relatively less.
  • For any new developer, it is very easy to understand the logic
    of microservice providing only one functionality.
  • If particular microservice has larger user/audience in that case we need to only scale up that particular microservice not whole application.
  • These microservices as platform independent as we can use any technology as per our requirement.
  • If one microservice goes down then it can not affect whole application.
  • Microservices enables the continuous delivery and deployment of large, complex applications.
  • Require less time to test and deployment
  • The application starts faster, which makes developers more productive, and speeds up deployments

Disadvantages

  • Developers must deal with the additional complexity of creating a distributed system.Its complexity increases with the increase in number of microservices.
  • Microservices are less secure relative to monolithic applications due to the inter-services communication over the network.
  • Debugging is difficult as the control flows over many microservices and to point out why and where exactly the error occurred is a difficult task.
  • Deployment complexity
  • Causes Network Latency and security problems

Micro Frontends

Micro Frontend is microservice approach for presentation layer or front end
In simple words, We can divide front end in smaller components/feature called micro frontend

If we want our micro frontends to communicate each other by sending messages or events, we can use custom events and address bar (like query string parameter).

To understand better, we will discuss about same example that we talked in monolithic and microservice.

  • Application UI/ Frontend — responsible for handling HTTP requests and responding with HTML on browser. Now we have divided front end into small UI components like Flight, Hotel, Car and payment UI.
  • Business layer — the application’s business logic. In microservices architecture, we have created small services for each feature like flight, hotel, car and payment microservice. Now this business layer is easy to maintain.
  • Database — Single Database for entire application to store data

As per micro frontend, We have divided our frontend in smaller features and this small features will be handled by container application.

We also called Micro Fronend as Verticalised System. We can distribute this work according to vertical to different teams.

Refer below diagram for your reference:


Advantages

  • We can do incremental upgrades to UI
  • Simple and decoupled codebases
  • Maintenance It is easy to manage web app as it is relatively smaller in size.
  • If there’s any update in one of the web app / micro frontend, then we need to redeploy only that micro app. Hence, their start-up and deployment time are relatively less.
  • For any new developer, it is very easy to understand the logic
    of micro app providing only one functionality.
  • If particular micro app has larger user/audience in that case we need to only scale up that particular micro app not whole application.
  • These micro app as platform independent as we can use any technology as per our requirement. we can write one micro app in angular other is in react.
  • If one micro app goes down then it can not affect whole application.
  • We can have vertical segregation of different features

Disadvantages

  • Developers must deal with the additional complexity of creating a different micro apps and merging again into single app.Its complexity increases with the increase in number of micro apps.
  • Micro apps are less secure relative to monolithic applications due to the inter-services communication over the network.
  • Deployment complexity
  • Environmental differences
  • Causes Network Latency and security problems

References

Comments

Popular posts from this blog

Sonarqube Integration with Visual Studio 2022 and VS Code

Run And Debug Test Cases Using Jest With Different CLI Options

Install Kibana as Windows Service Using Powershell