MICROSERVICES && MONOLITHIC ARCHITECTURE SIMPLIFIED

ANKIT JAVERI
6 min readNov 21, 2022

--

MONOLITHIC ARCHITECTURE:

MONOLITHIC ARCHITECTURE

Image Source: Courtesy: https://www.google.com/

Monolithic architecture is a traditional way of building application.

It is built as a single and indivisible unit.

Three important components of Monolithic Architecture:

1. Client-Side Interface: Interface Layer

2. Server-Side Applications: Business Logic Layer

3. Database: Data Interface Layer and Database

Above components are combined into one and all its functions are served and managed into one place.

Due to which application has a large code base.

So, any changes when needed due to any updates or during debugging the error the application stack needs to updates which consumes more time to solve problem or to add any updates due to its monolithic nature.

This architecture lags modularity (means each function can be build an as micro component application and then those small micro components can be connected via servers and APIs).

Example:

Let’s say there is shopping website like Amazon, assume if website like Amazon was built up on Monolithic Architecture (i.e., entire code in one user space). Entire code into a Single Application.

Amazon already has so many different components sign in into account, searching for the product as well adding that product into cart and buying / making transaction of that order.

It will be so difficult for Amazon to show the user different category of products which user searches for as well as so difficult for to add that product and to make its respective transactions. When the system is monolithic it will take a huge load onto server / website interface as well as slowing down retrieval of data from database which user was searching for and slowing down the payment transactions.

In this case the application remains tightly coupled and all user various components and modules are connected with each other.

Advantages of Monolithic Architecture:

1. Starting a new project and developing it is simpler using monolithic architecture.

2. Easiest to implement.

3. Components like frameworks, templates can be easily applied.

4. Simple to develop.

5. Deployment is very simple. All you have to do is paste the previously prepared application to the server.

Disadvantages of Monolithic Architecture:

1. When monolithic application scales up, it becomes too complicated to understand.

2. Complex code within one application becomes too hard to manage.

3. Implementing changes in a single large and complex application with highly tight coupling becomes extremely difficult.

4. If any code changes it affects the whole system so it has to be thoroughly coordinated, thus making overall Development process much longer.

5. You cannot scale whole component independently, only the whole application scaling is being done.

6. It becomes extremely difficult to apply a new technology in a monolithic application because entire application has to be rewritten every time any new technology or upgrades to application is done.

MICROSERVICES ARCHITECTURE:

MONOLITHIC ARCHITECTURE V/S MICROSERVICE ARCHITECURE

Image Source: Courtesy: https://www.google.com/

Since we saw the Monolithic applications are used in some situations but when move our Development from Monolithic Architecture to Microservices Architecture our Development Process increases as well as Productivity improves.

Microservices are service-orient architecture which is built from modular components to create a larger application.

1. Microservices breaks it down into collection of smaller independent units.

2. These units carry out every application process as a separate service.

3. All services have their own Business Logic, Database as well as perform a Specific function.

4. The entire functionality is split into independently deployable modules which communication with each other through API (Application Programming Interface).

5. Each services covers its own scope which can be updated, deployed and scaled independently.

Five Important Components of Microservices:

1. Microservices:

Main component of microservices is self-contained services.

2. Containers:

a. Containers are package of software that functions independently.

b. Containers work to isolate each service in same environment.

c. They are more efficient since they only rely on specific dependencies and underlying code within the service.

3. Service Mesh:

a. It offers a layer of infrastructure that provides additional security and makes more predictable behaviors in terms of communication.

b. It also uses sidecar pattern and sidecar proxies to provide dynamic messaging.

4. Service Discovery:

a. It helps manage deployment and evenly distributes the data load.

b. It features service provider, service registry and service consumer.

5. API Gateway:

a. It allows faster communication between clients and microservices by handling administrative tasks as well as ensuring microservices load is lightweight.

b. It also performs load balancing whenever necessary.

Advantages of Microservices Architecture:

1. Easier Understanding:

Microservices is extremely easy to understand and manage.

We just need to focus on specific services which are important and related to our business logic.

2. Improved Scalability:

Since all components are independently created so it becomes extremely simple to manage and scale those individual components.

Entire process is more time and cost effective when compared to Monolithic Architecture where in order to scale entire code has to be changed in a single application.

3. Independent Components:

All services can be deployed and updated independently, which gives more flexibility.

Bug in one microservice has only impact in that particular service and does not influence the entire application.

4. Higher Agility:

Fault in one microservices affects only that particular services due to which it becomes extremely simple to debug with low risk and fewer errors.

5. Flexibility in choosing and upgrading new technologies:

Since it is microservices it becomes much simpler and easier to upgrade new technologies micro component wise.

Disadvantages of Microservices Architecture:

1. Increased Complexity:

It has a learning curve which takes time since microservices are much more complicated system to understand.

2. More Expensive:

a. Microservices are more costly. They run in their own environment with their own CPUs.

b. They work through API calls which have a price tag.

c. Also have more labor cost since building more complicated environment requires huge engineering team.

3. Greater Security:

Since microservices exist through different environments on different running machines with different API calls, they offer more point of contact to an attacker who can damage the system.

4. Testing:

A multitude of independently deployable components makes testing a microservices-based solution much harder.

Example:

MICROSERVICES ARCHITECTURE

Image Source: Courtesy: https://www.google.com/

Let’s take same example of Amazon, while building this e-commerce application that takes orders from customers, verifies inventory and available credits and ships them.

Application in a image above consists of Several Components such as:

1. Storefront WebApp:

Implements user interface and is able to connect to all other services.

2. Inventory Services and Database:

Checks for searched product from inventory database and maintains its services.

3. Shipping Services and Database:

Checks numbers of orders to be shipped or already shipped through its database.

4. Account Services and Database:

Maintains records of numbers of orders purchased and amounts per order purchased including its time.

5. API Gateway:

It is most important services through which communication between all components are done.

Conclusion:

We can use and deploy microservices:

1. Independently Deploy New Functionality with Zero Downtime.

2. Isolate Specific Data and Data Processing through Data Partition.

3. Enable a High Degree of Team Autonomy.

4. Reduce the time and cost consumption.

5. Reduce Complexity of Project.

6. Build a highly Agile Application.

7. Modules or components that can be reuse across diverse channels such as login services module, search option module, authentication module, payment transaction module etc.

--

--

ANKIT JAVERI
ANKIT JAVERI

Written by ANKIT JAVERI

In a journey of learning something good everyday

No responses yet