Microservices for Dummies

This post is a part of blog series Understanding Container Fundamentals - Step by Step.  Click here to visit series contents

Regardless of the what industry are you working in, I am sure you must have heard heavily of Microservices and Microsegmentation. Today, when apps hold business logics, it has become even more vital to strengthen the core and secure the surface of such apps so that you get a resilient application stack.

With introduction of microservices, we are seeing a remarkable advancement in the way these apps are developed and it is being deployed.

Concept of microservices revolves around the fact that a traditional (monolithic) app is a collection of multiple services or functionalities which talk to each other to give us a desired interface and business logic, which can be broken down to different branches of code which in turn can be self-contained with their own independent database, where one can talk to other using a well-defined way such as APIs. These branches of code of a service or an application can be treated as micro-services with a micro functionality of its own which when integrated with other such micro functionalities will give us the required business logic.

Microservices have enabled significant advancements which are changing the way we work. Typically hosted on containers, it enables agile software development foundations which are cloud native, DevOps culture with continuous integration and continuous deployment (CI/CD) cutting down the turn over times to develop, deploy, maintain, patch or enhance an application.

Now that we understand a bit about microservices, In the upcoming section, lets focus on understanding how it makes a difference while developing and deploying a monolithic application vs a microservices enabled application:

Monolithic Applications

Consider an example of a mobile ticketing and commerce application which users would use to buy tickets for travelling on different transport vendors with various modes of transport.

Typically, after understanding the requirements, a code will be built with a core ticketing logic interacting with multiple interfaces.

A Monolithic Application

Such applications are packaged as WAR files, self-contained executable JARs and deployed on application servers such as Tomcat or Jetty.

This approach to develop applications have been quite common along the years since it is simple and small to start with respect to development and testing. Important point to note here is it is a good approach to start with. As applications are getting to demand more and more now, continuous development is essential which makes application code never ending and hence, monolithic applications will grow like anything which will essentially make a developer’s life difficult gradually and tester’s likewise.

Take an example of adding a new vendor to application or a new payment bank or API gateway. For an application consumer, it might just be an added functionality, it takes understanding of existing code to add new branches and some good luck with rigorous testing with code merges happening around.

To summarize, an application is bound to grow which will essentially make it difficult to understand, manage and scale for new developers and testers to test the functionality too.


Battle it out with MicroServices

Such challenges of monolithic applications can be solved by adopting microservices approach which is also known as MicroServices architecture pattern which essentially means Instead of building a single monolithic application, lets split the application into set of smaller, interconnected functions or services.

Each service is a functionality in its own which can be connected to other dependent services using APIs to give a complete feel of application.

Consider the same example, the one of mobile ticketing and commerce application which users would use to buy tickets for travelling on different transport vendors with various modes of transport.

In this case each colored box is a service in itself which no longer makes a single service with giant application code.

A Microservices Application

Now consider the same example of adding a new vendor or new payment gateway, in this case you don’t need to modify your existing working piece of code. However, you just need to introduce a new micro service which is consumable using an integration mechanism such as API.

Moreover, if you need to develop a similar application for some other enterprise with similar business logic, you can re-use the ticketing logic application micro service with integrations with different payment gateways or API gateways as per business policies of new enterprise.


What are the benefits of MicroServices

  • Less Complexity – It makes an application easier to understand as we are now dealing with smaller codes
  • Easy to ManageIt makes an application easier to manager since it is easier to understand and test
  • Faster to developMicroservices enables agile framework by enabling individual components to be deployed independently
  • Reusable - Microservices enabled a code to be reused as it is a mere functionality with less or no hard coded information
  • Enables continuous integration / continuous deploymentAn application can be easily integrated with new functionalities / services without impacting original code
  • Placement of different microservices as per the best fitA CPU intensive microservice can sit on different hardware than a Mem or IOPS intensive microservice
  • Individual components of an application can be scaled up / out independently - Since different components can be scaled independently, a web application with high number of web requests can have more web micro services instead of adding a completely new application server.

This post is a part of blog series Understanding Container Fundamentals - Step by Step.  Click here to visit series contents

Leave a Reply

Notify of