Introduction to Microservices

Jolly Fish
Technically True🚀
3 min readJul 23, 2020
Photo by Louis Reed on Unsplash

This article is based partly on the video tutorial, What are microservices really all about? by JavaBrains, available on Youtube

What is a Microservice

Traditional architecture of applications is a Monolithic architecture where all the code building the application exists as a single, monolithic entity (possibly separated as layers). The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. Even after modularization, the final deployed entity is mushed together as a single entity.

The complexity needs to be managed not only at the coding level but also at the runtime/execution time of the code.

Monolithic vs Microservice architecture

Advantages

  • Microservices are language independent as they interact using HTTP calls
  • Allows splitting up microservice in its own team. Thus, unlike monolithic structure, work division is convenient
  • Isolates faults and exceptions. Failure of one microservice does not lead to full blown failure
  • Work well with containers which makes them highly dynamically scalable. In monolithic systems, scaling up/down was applied to the entire monolithic application, not specific components as the deployed product was monolithic. Thus, even if smaller components need scaling, monolithic systems will require scaling the entire deployment. With microservices, scaling may be done to individual modules

Disadvantages

  • Complexity. Instead of a logically organized, monolithic application, there is a network of microservices which interact with each other. Tracing faults is harder
  • Knowledge overhead. Containerization and structure is needed. Architecturally, there should be able to dynamically spin up databases, etc

Instead of deploying the entire application on a single system, with the advent of web applications, the applications can be split into smaller modules which are deployed on separate machines and interact with each other through HTTP calls

Containerization

A platform, like Docker, allows containerization which puts all application requirements on a single image which can be run on any system which supports Docker. This eliminates inconsistencies in running applications across systems.

Containers are a way to package software in a format that can run isolated on a shared operating system. Unlike VMs, containers do not bundle a full OS — only libraries and settings required to make the software work. This allows, efficient, lightweight, self-contained systems that guarantee the software will run exactly the same, regardless of where it is deployed

VM vs Container

Further, containers can share common libraries and bins to minimize size of such docker files.

The Docker File describes the build process for the actual code (the Image). Thus, based on the Docker File, the Image may be created which can be run on any system

--

--