Microservices architecture is getting lot of attention these day and being used by Uber, Netflix, Linkedin and many other other companies. I am sure you would have worked on various application which use monolithic architecture. There are considerable problems with monolithic architecture which we wont face if use microservices architecture. We face lot of problems in terms of deployment, scaling, understanding huge code base , moving to new framework, continuous delivery of new features, in term of coupling between components etc.
Microservices architecture allow big application to divide into small, loosely coupled services. It comes up with lot of benefits which we are going to discuss here.
- Lets say you have one e-commerce application which was developed using monolithic architecture, and over the time it has grown with lot of new features. Now codebase became huge and few set of people going to join your team. It is very difficult for them to get started with given application as there is no clear separation between various components of application. Now after spening lot of time, they added few bug fixes to existing codebase. There are high chances of breaking existing features as it is very complex and you need to be very careful in term of making changes in existing codebase. It might take lot of time, and you wouldn’t be confident even after spending lot of time. Microservices alllows you to see your application in terms of small, loosely coupled components, anyone can get started with existing application in short span of time and, it wouldn’t be too difficult to add new fix to codebase. You should have well written documentation for each microservice which covers all the apis.
- Imagine today you are running promotion. So you would be getting huge amount of traffic. And somehow your message component broke. It will affect whole application, and it will cause whole application to go down. If same happens in microservices architecture, you won’t face such failures as it runs multiple services independently so even if one goes down, it won’t affect other services. And it would not have huge impact on business unless it is not category/tier 1 microservice.
- You are group of people who spent lot of time in terms of understanding your application codebase. you guys existed about adding new features ex. product trending features, search etc. You have to redeploy whole application to show this features to end users. And you would be working on many such features, just think about the time it is going to take every time in deployment. So if your application is huge, it takes lot of in building, deployment etc which definitely cause loss of your productivity. Nobody likes to wait for 10 minutes or more and then see the result of code changes. In microservices architecture we try to make codebase as small as possible in each service so it doesn’t take much time in terms of building, deployments etc.
- Today you getting huge amount of traffic, and nothing got broken, servers are up. Lets say we need to scale any one components here ex. payment, you can’t scale individual component in monolithic architecture. In microservices architecture you can scale any component separately with adding more number of nodes dynamically.
- You started with some old framework initially, and now if you want to move to new framework, or technology stack. It becomes very difficult in monolithic architecture as it has become very big, complex over the time. It is not that difficult to achieve in microservices architecture.
That’s how microservices architecture makes your life easy. There are various strategies available which help you in diving application into small services ex. decompose by domain driven design, decompose by business capability etc. I would strongly recommend anyone who is just starting with microservices architecture to go through below given case studies :
Microservices at Netflix: Lessons for Architectural Design
In some recent blog posts, we've explained why we believe it's crucial to adopt a four‑tier application architecture in…
The Opportunities Microservices Provide at Uber Engineering
A few months back, we discussed Uber's decision to abandon its monolithic codebase in favor of a modular, flexible…
What Led Amazon to its Own Microservices Architecture - The New Stack
The real story of The New Stack, time and time again, has been about how companies with huge server demands…
Everything comes up with pros, cons, and microservices architecture has cons too. I would keep writing about microservices, various design patterns available in microservices architecture, event driven architecture in future.Thank you so much for reading this.