Microservice vs Monolithic Architecture

Posted on May 12, 2017

Microservice vs Monolithic Architecture

In today’s world, everyone is striving to have a web application, rather than a website. Because of that, our simple website, begins to grow in a complex web application.

In this blog post, I’ll be sharing one way of handling a complex web application, with the help of, microservice architecture. Also when should we prefer microservices, over a monolithic application.

Monolithic Architecture

In simplest terms, Monolithic means composed all in one piece i.e. code components are interconnected and interdependent.

For example, when a web client (browser) sends a request, following happens:

The business layer performs the business logic.
Data access layer performs database collects/stores specific tasks.
Presentation layer shows the data to the user.

Basically, the same code base maintains all the code (presentation, business and data access layer).

Mircroservice Architecture

Microservice Architecture

In general, a microservice is: 

A self-contained, well-defined, small and independently deployable unit.
Which does not depend on the state of other services.

The idea is to split application into a set of smaller, interconnected services instead of building a single monolithic application.

Each microservice is a small application that has its own architecture, consisting of business logic along with various adapters.

Most microservices expose REST APIs and most services consume APIs provided by other services.

Mircroservice Architecture


Benefits of Microservice Architecture

Easier to understand and maintain: Microservices tackle the problem of complexity by decomposing application into a set of manageable services which are much faster to develop, and much easier to understand and maintain.

Adopting new technologies: Each service is independent so choosing programming language is more dependent to actual problem, rather than choices made at the start of the project.

Fault isolation: Microservices improve fault isolation so that the application can remain largely unaffected by the failure of a single service.

Scalable and Cost effective: Scaling services, as the need arises, is much cost effective.

Say, an application consists of 2 modules – auth and product. Due to microservice architecture, user can scale any one service(say product, without actually affecting the auth service).

Also, with the AWS Lambda like auto scalable services, in case of increased demand for a particular service, it’s very easy and much more economical to scale micro-service.

Benefits of Monolithic Architecture

Complexity: In a microservice based application, It is more difficult to implement changes that propagates through various services. In a monolithic application, it is relatively simple to update the corresponding modules, add the changes and deploy them in one go.

Deployability: For monolithic application, all changes can be pushed via single deployment.

In contrast, a microservice application, generally, uses various services.
Each service requires its own set of configuration for deployment as well as monitoring, which adds additional level of overhead.

Testing: If a functionality depends on various services then testing it becomes very complex. In monolithic application, testing is relatively easy.

Handling Failure: In a monolithic application, components are internally connected to each other so handling failure is much easier as everything is, part of single application.

In a microservice application, developers need to handle the logic for, intercommunication as well as failures, between services, which ultimately increases complexity.


Microservice based architecture provides a lot of ways to handle a complex system, but also comes with its own set of challenges and complexities. Mainly microservice based architecture is very useful, if application is really big, complex, and does a lot of different things.

Although there is no solution that fits all cases but, in case of a simple application, monolithic architecture is a better approach.