Published on

Quickstart Microservices architecture tutorial


Table of contents

Define Microservices ?

We hear constant buzz around microservices, but what are microservices anyway ? Microservices architecture is a type of software architecture where your code/application is made of several smaller services.

In simpler words, instead of having one big piece of software that does the job, we split the application into smaller, independent services - each of which helps to achieve some part of the job.

Features of Microservices :

Some of the features expected from these smaller services are as follows :

  • Services should be highly maintainable and testable
  • Services should be loosely coupled. These services are supposed to be less/not dependent on other services for operations and deployment.
  • Services should be designed and developed around its capabilities.
  • Each of the services should abstract out its complexity. Services should communicate with each other using well defined message channels or APIs.

What's the advantage of introducing so many services ? :/

Microservice architecture has its own advantages, it's scalable, cost-efficient and resource-efficient. Some of the advantages of microservice architecture are as follows :

  • Ease of maintenance : When something breaks, instead of debugging and releasing a fix to the entire codebase you fix and release the individual service. This is easy with microservice architecture, because each of your services are independently maintainable, testable and deployable.
  • Polyglot tech stack : With microservices, each of your services can be developed in a different tech stack altogether. Because the communication happens over messaging channels/APIs, you are not restricted to develop the entire application in a single programming language.
  • Increased reliability : With microservice architecture your system is fault-tolerant, as there will be no single point of failure.
  • Scalable application : Unlike monolith architecture, you can scale up or scale down your services individually as per their load. E.g. in a video streaming application deployed as microservices, if the streaming service has high load average you can scale it up individually, while your auth and other services can keep running with the same config.

Are there any disadvantages to Microservices ?

Yes. Introducing multiple services in any system pose the following problems :

  • Network latency : If not managed properly, your overall application response can slow down if inter-service communication is impacted.
  • Difficult to test : High number of services can make it difficult to test the system as a whole.
  • Development time : Because the logic is now broken into smaller services and codebases, development time with microservices is often higher than that of monolith architecture.
  • Complex deployment : An application deployed with microservice architecture has different services that may require different environments, along with the messaging channels if any. As a whole, deployments for Microservice systems are often complex in nature.

Should I use microservices ?

Microservices is the preferred choice of architecture most of the time. It makes sense to use microservices architecture if you want to take care of scalability, agility, manageability and all the other features mentioned above.

However, if you are starting out and are not sure if you will even need to scale the app in future or not - it makes more sense to go with monolith architecture and slowly move to microservices as the need arises.

Awesome Microservices : Index of resourceful links and tutorials around Microservices.

Should I use microservices, by Orielly : Informative guide explaining if you should use Microservices.