Microservices – Basics
The idea behind microservices is to build and maintain application, with composable pieces which work together in contrast to a traditional, “monolithic” application which is all developed all in one piece. Let’s start with monolithic application and then we talk about microservices.
Monolithic applications are typically huge, with million lines of code on average. They are responsible for every possible functionality of product like executing domain/business logic, handling HTTP requests, database operations, background processing, communication with the client, handling authentication and so on ….as Large Single Unit.
Due to this, even for small changes in the system involves building and deploying the whole application. Example: if we have to make correction of bug…where change is one line of code, we have to make new build of whole system again and deploy which requires a lot of time. Not only this, we have good number of problems with monolithic.
Quickly lets list what’s wrong with Monolithic:
- Architecture is hard to evolve.
- Difficult to scale. ( even if you have to scale a part of system)
- Long development pipeline ( Build, test, release).
- Adding a feature can take time.
- Continous Delivery is challenging.
- Debugging problems that arise in them, is a huge challenge.
- A lot of time between releases.
- Almost impossible to bring in new technologies and technical processes
In microservices architectures, instead of building a large application, we break into as a collection of small autonomous services, modeled around a business domain. Helps us to work independently on individual services by separating the responsibilities without impacting ongoing work on other services, the application can grow as company and other requirements grow with time.
The main difference we observe in the above diagram is that all the features initially were under a single instance sharing a single database. But then, with microservices, each feature was allotted a different microservice, handling their own data, and performing different functionalities. This way the architecture promises to keep teams scaling and function better.
Microservices – Advantages :
- Easy fault isolation, system continue to work even if one service fail.
- Easily develop based microservices based on their individual functionality
- Individually deployment of any service with stopping whole application
- Multi technology stack to build different services of the same application
- Scale Individual components as per need.
- Promotes the adoptions of new technologies.
The true problem of microservices in not a technical one! Many problems are caused by misunderstanding, not knowing or not using concepts from Service-oriented architecture (SOA), Event-driven architecture ( EDA) and Domain-Driven Design (DDD) Principles and Patterns.
So, given the history of SOA, microservices are not actually all that new of an idea. However, microservices have become more viable thanks to advancements in containerization technologies.
Adoption on Microservice Architecture achieve significant competitive advantages over rivals ! note that Spotify, Netflix, Linkedin, Amazon, Google,…are few early adopters are now standing high globally.