Monolithic vs. Microservices Architecture (Part 2)

Kasun Dissanayake
5 min readApr 20, 2020

--

In this article, we are going to learn about Microservices Architecture. I think now you have a better understanding of the Monolithic architecture. Please go through my previous article and get the basic understand of Monolithic Architecture.

Now we can discuss What exactly Microservice Architecture is?

Microservice or also known as Microservice architecture is an architectural style that structures an application as a collection of small autonomous services, modeled around a Business Domain. I will put it in simple terms. Basically, it is a self-contained process which always different and unique business capability.

If you have a large application to build using the architectural pattern. It can be broken down to small multiple services together as one large system. But behind the scene, it is a Microservice. So we have multiple services on all of these services. They do not share the data structure. But they will be communicating through API. The major advantage of breaking down the system to each Microservice can focus on only one single business capability and it leads to better quality and growth. I’ll explain to you this with a simple example.

In the E-Commerce site example, you can remember monolithic architecture and the components were in a simple module. But in the Microservice architecture, all the components divided to separate modules. Which communicates each other using a well-defined interface. Now communication between Microservice is a stateless communication. Each pair of Request and Response have an independent contraction. Because of this Microservice can communicate effort. Moreover in Microservice architecture, the data is separated.

Each Microservice is responsible for its own data model and data because of its interaction with each Microservice is handled by different instance. Unlikely monolithic architecture. So we have 3 Microservice in the E-Commerce example. Customer Microservice, Product Microservice, and Cart Microservice. Each of them has its own instance and they have own Data Model and Data. So this is what exactly Microservice architecture is.

Microservice Architecture

Now let's talk deeper about this architecture. Now as you can see in Microservice architecture service is small independent and loosely coupled. Each of these services has a separate codebase that can be managed by a small development team and can be deployed independently. All the services will have a codebase which can be not huge compared to the monolithic architecture.

Basically the team can be updated the code without rebuilding or deploying the entire application. You can update each and every service independently. The internal implementation of each service is hidden from other services. Moreover, they don’t need to share the same technology stack libraries or frameworks as well(independent from each other). Besides for the Microservice themself, some other components appear in typical Microservice architecture.

  • Management — This component is responsible for placing services on nodes. Identify failers and rebalancing services and soon.
  • Service Discovery — It enables service lookup to find the endpoint for a service.
  • API Gateway — The entry point for the client. The client will not call all the clients directly. First, go to the API Gateway then it will forward the call for appropriate service on the backend. API Gateway might aggregate the responses from the services and return the aggregate response.

Features of Microservice Architecture

  • Small Focused — The Aim of Microservice architecture is simple.
  • Loosely Coupled — Each Microservice is independent of other Microservice and does not need to coordinate as well. This makes development and deployment really quick. To update a particular service We need only update that service. You do not need to update other services.
  • Language Neutral — To be a good Microservice it must be language neutral. For example in an application few services can be written in Python for fast deployment and few services can write from Java. It does not affect other Microservice.
  • Bounded Context — Each Microservice does not need to understand the implementation of other Microservice.

These are a few features of Microservice architecture.

Advantages of Microservice Architecture

  • Independent Development — Each Microservice can be developed independently. A single development team can build test and deploy.
  • Fault Isolation — This is a very bigger advantage and basically if a service goes down it will not take down the entire application. For example, if my Cart Service goes down my entire application still exists. Unlike the Monolithic architecture if one of my components goes down the entire application will work.
  • Mixed Technology Stack — You can use any technology for each Microservice.
  • Granular Scaling — This means services can be scaled independently.

Companies using Microservices

Spring Boot — What’s it got to do with microservices?

First of all, spring boot is a great project. Spring boot use default config but no longer mass of config files. This feature is supported by auto-config the project. And, spring boot uses embedded containers, so that you can just start up a service single. That is your self config container such tomcat\jetty is no longer needed. Finally, microservices are just a concept of a service, you can split your service in any way. i.e. every controller class as a microservices is fine, every module as a microservice is fine. For me, use spring boot to build a microservice is a way to quickly deploy service at any service environment, I can start a service just copy a jar to a new service, and, run it just use java -jar.

Thank You!

--

--

Kasun Dissanayake
Kasun Dissanayake

Written by Kasun Dissanayake

Senior Software Engineer at IFS R & D International || Former Software Engineer at Pearson Lanka || Former Associate Software Engineer at hSenid Mobile

No responses yet