Kick Starting your Microservices (Part 1)

Harshpreet Singh
Walmart Global Tech Blog
3 min readFeb 18, 2020

WHY MICROSERVICE ARCHITECTURE? WHY NOT MONOLITHIC ARCHITECTURE?

When services are loosely coupled, a change to one service should not require a change to another.

Sam Newman

I would be posting two parts of this series. This blog is for the entry level to intermediate software developers to know the best practices and guidelines for building your microservices. In a microservice world, still most of the people do mistake of writing tightly coupled services which is no good than a monolithic system!

Before taking a deep dive into the Microservice Architecture one should know about the Monolithic architecture, its shortcoming and why all the tech giants were quick to adopt Microservice architecture.

MONOLITHIC ARCHITECTURE

The Monolithic application describes a single-tiered software application in which different components combined into a single program from a single platform. Component like Business logic, Database layer, Posts, Notification module etc.

Monolithic architectures are hard to scale. New Requirements, languages, technology update becomes very hard, difficult to transform and it is impossible to add new tech and limits innovation.

Few advantages of monolithic architecture — For smaller applications it is simple to Write, Test and Deploy!

SHORTCOMINGS

Let’s take an example, There is a monolithic bank application containing transaction/payment service and a user profile update service.

A bank might not have many request to update a user profile in a single day, but can have thousands or lakhs of payment/transaction requests in a single day! Now the bank need to scale the transaction service so it can handle a quite large load.
But here is a catch!

We can’t scale a single service in a monolithic architecture, we have to scale the whole application (Scale the whole bundle containing transaction and profile). Now on scaling the whole app, let’s say having 10 instance instead of one, there is unnecessary scaling of the profile service too which wasn’t needed in the first place.

It’s an overhead and will add to the cost factor. You don’t want to pay more for hosting, do you?

More shortcomings –

  • Difficult to understand a large and complex application as high dependencies and tight coupling.
  • The bigger the application, more time it takes to start, load dependencies.
  • Have to redeploy the whole application in case of some code update/fix.
  • Difficult to debug, breaks the whole application as all things are tightly coupled

Summary

As monolithic approach best suits for lightweight applications. It is important to understand Monolithic architecture since it is the basis for microservices architecture where each service by itself is implemented according to monolithic architecture.

Microservices approach is all about handling a complex system, but in order to do so, the approach introduces its own set of complexities and implementation challenges. which we will learn in the next part of this series!

--

--

Harshpreet Singh
Walmart Global Tech Blog

SWE@LinkedIn, Tech Blogger (Scala | Java | Big Data | Spark | Azure | CI/CD | CloudFoundry) | Ex-Walmart| Ex-SAP | NSIT