Introduction to Microservices

What is it?

Cisco Eng-emojis  data network engineering GIF

Single application built as suite of small services which have following characteristics:

  • Loosely coupled 
  • Communicating lightweight protocol
    • HTTP
    • REST etc
  • Each running as independent processes
  • Separately written, deployed, scaled

Is it SOA?

no GIF

Not SOA, you can say a variant of SOA. SOA: talks about integrating various enterprise applications.

Microservices: decomposing single application into suite of smaller applications.

What are Monolithic Applications?

Grande Medir GIF by Hidrogenesse

Consider you have a E-commerce application with following functionalities:

  • Searching
  • Product Catalog
  • Inventory management
  • Shopping cart
  • Payment Management
  • User Management
  • Order Management
  • Checkout

Now if you create it as a monolithic application, you will create a single service (app) that provides all the required functionalities.

Ok, so what are the disadvantages of the Monolithic?

Here are few disadvantages:

  • Locked to technology/language
    • An entire app is written with a single tech stack, hence changing the tech stack will become a big task
    • Cannot experiment/take advantage of emerging technologies, you are stuck with the initial tech you use.
  • Difficult for a single developer to understand complete code
  • Generally, a big team is working on the entire app, hence you will have to deal with numerous issues during merges and merge conflicts.
  • The single app is generally connecting to multiple databases, loaded with validations and business logics, hence becoming complex.
  • Changes of one functionality are held back by other changes.
    • You can’t release your changes till other functionalities are done and tested.
    • If there is a bug in other functionality, you can’t release your functionality.

Abc Love GIF by The Bachelor

Are there any advantages of Monolithic applications?

Well yes.

  • Easy to test as a single unit.
  • Easy to deploy as a single unit.
  • Easy to scale.
  • Easy to manage changes.
  • Easy to manage versions.

How will you create the same e-commerce app in the Microservices world?

bill nye fire GIF by NETFLIX

What are advantages of micro-services?

  • Faster Delivery: 
    • Less code to change
    • Less code to test
    • Easy deployment steps
  • Scaling:  
    • We can scale individual services based on their use
  • Easily understood: 
    • Since microservice size is small, a person or team can easily understand in and out of microservice
  • Technology/language advantage
    • Different process different technology
    • If we have to change tech or language from java to python, it is small module for which we have to change
  • Change cycle decoupled
    • Each functionality or micro-service can be deployed when
  • Culture: Well defined ownership, hight trust in team
  • Easy deployment steps
  • Isolation: Single microservice cannot crash entire system
  • Flexibility: Polygot services, own persistence system etc
grace helbig wow GIF by This Might Get

Are there any challenges of micro-services?

You have to take care of:

  • So many services to manage.
  • More monitoring required.
  • Design for failures
  • Remote calls vs in process call speed
  • Transactions which goes over multiple services
  • Sometimes features spans multiple services
  • Multiple services required to be tested together
  • Version management
Pop Tv Johnny Rose GIF by Schitt's Creek

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s