DEV Community

Cover image for Monolithic vs Microservice Architecture- Pros and Cons
Mahipal Nehra for Decipher Zone

Posted on

Monolithic vs Microservice Architecture- Pros and Cons

The hassle that large scale enterprise applications under development bring to the table of software developers was too much. There was no solution at all to this problem that’s why a different architectural style was required. Hence the term "microservices" came into existence after the sustainable development in cloud computing space, it was first used by Dr Peter Rogers in a conference on cloud computing in 2005.

Article Source: https://www.decipherzone.com/blog-detail/Monolithic-vs-Microservice-Architecture

"Microservices" was premiered at an event for software architects in 2011, where the term was used to describe a style of architecture that many attendees were experimenting with at the time.

The Monolithic architecture is the conventional style that we have been using normally whereas the Microservices architecture is used only in extremely large-scale applications which cannot withstand downtime.

What is Monolithic Architecture?

Web Applications usually consists of three parts

Front End client-side application is written in JavaScript and other languages.

Back End Server-side application which contains business logic written in java, PHP, Python or some other language.

Database of whole web application

All of these parts are closely coupled and frequently communicate with each other. Hence the whole web application works as a monolith where every part is dependent on others.

Checkout: How Web App Development Process is Becoming More Efficient?

Advantages of Monolithic Architecture

The code structure of monolithic architecture is small as compared to microservices architecture. Hence the Monolithic architecture-based web applications are easy to develop, easy to test, easy to deploy and easy to scale.

Disadvantages of Monolithic Architecture

The complexity in Monolithic Architecture increases too much with bigger size which makes this approach limited to a certain size of projects.

The increase in the size of the web application increases startup time.

Bigger web applications become more complex and consequences in reduced code readability, difficulty in development and debugging.

Changes are one section of the code can cause an unanticipated impact on the rest of the code.

Extensive testing and debugging are required on integrating new code.

Continuous Integration and continuous deployment become difficult.

In case a part of web application shuts down then rest of the web application will go down as well.

When to use Monolithic architecture?

Monolithic architecture can be used in projects which do not require real-time response and they can withstand downtime. These kinds of projects are limited to a certain size if the web application’s size is expected to go beyond that then Microservice Architecture should be adopted. Most of the web applications that we normally use are based on monolithic architecture.

Checkout: What is an API and How it works?

What is Microservice Architecture?

In Microservice Architecture big web applications are divided into smaller services, where each web service is responsible for executing a particular set of functionalities. If we take the example of a gigantic eCommerce platform then that Web application can be divided into smaller applications as following:

Product searching application

Inventory Management application

Product selection & Shopping application

Payment Application

Allocating delivery to logistics partner

The upselling application that uses data analytics and machine learning.

From the above example, it is evident that the execution of Microservice architecture is complex and requires extensive planning.

Checkout: What is Serverless Web Application Development?

Microservices architecture isn’t just limited to coding, it requires well-planned deployment on cloud platform too. The smaller applications are deployed on different server instances, hosts of shared servers and function as a service platform depending on the requirement of a web application.

Advantages of Microservice Architecture

The big web applications when broken down into smaller services increase code readability.

The smaller services are easy to develop, integrate, test and debug.

The smaller services can be independently developed by different teams with their choice of the technology stack.

Easier Continuous Integration and continuous deployment.

The unanticipated impacts on code integration are drastically reduced.

Lesser bugs and resource conflicts will be created on code integration. Hence the Cost of testing and debugging reduces.

Since the code being used frequently can be deployed on function as a service platform, the service will offer almost zero downtime with the agility to handle abnormal spikes in requests.

The distributed deployment eliminates the need of buying expensive server hosting and resources.

Disadvantages of Microservice Architecture

To build Microservice Architecture based web applications highly experienced and expensive resources are required.

Building Microservices based web applications requires web developers, cloud architects, DevOps engineer, Quality Analyst, Project managers, Business Analysts, Product Managers and lots of other team members that are defined in a scaled agile framework.

Microservice Architecture adds the complexity of distributed systems. The web developers have to write the code to handle partial code failure, services failure and discrepancies occurred on using distributed systems.

Overhead of Implementing an inter-process communication mechanism based on either messaging or RPC.

Testing microservices is typical because in order to test a service that is dependent on other services the developer and the quality analyst will have to run all the base services first.

Nowadays Kubernetes and Dockers are being used to host the services.

Every service in Microservice architecture-based web applications uses a different database. Therefore, there is an overhead for developers to reflect the changes in common columns of different databases.

Making changes in services can become really tough when service is widely being used among other services.

When to use Microservice Architecture?

Microservice Architecture should be used only in big projects which requires either real-time responses or the projects which cannot withstand downtime and can have abnormal spikes in users at a point of time. Projects on which telecommunication, television networks, Ridesharing apps, food delivery apps and gigantic eCommerce platforms run are usually based on Microservice Architecture.

Article Source: https://www.decipherzone.com/blog-detail/Monolithic-vs-Microservice-Architecture

Top comments (1)

Collapse
 
aschwin profile image
Aschwin Wesselius • Edited

Thank you for this article!

I've always liked this presentation by Juval Löwy, who coined a similar approach in 2006. I've no idea if he knew about Peter Rogers idea at that time.

This presentation is from 2009 at time where Juval Löwy and his WCF team already implemented this approach. They probably already started building it prior to 2006.

youtube.com/watch?v=w-Hxc6uWCPg

If you watch it completely, you notice the amount of detail Microsoft and in particular Juval Löwy had put into this implementation.

I particularly suggest to read "Programming WCF Services" by Juval, since it goes into depth on why certain decisions are made within this framework. In other words, it explains the pitfalls of microservices to very precise details. Yes, take heed.