Micro Services Architecture Vs Monolith Architecture:
You might have heard about these terms again and again. But what are they, their advantages and disadvantages?
Let's discuss it in this thread: 🧵👇🏻
Micro Services Architecture:
Micro Services is an architectural style where a single application is built as a suite of multiple smaller services which are loosely coupled, maintainable and scalable separately.
Let's discuss what that means.
👇🏻
Let's take the below example:
As you can see, our example application takes care of user accounts, reading and updating inventory and shipping the products to end users.
👇🏻
Now in the micro services architecture each of these functionalities are implemented using different services and they have their own database to keep the related data.
Services talk to each other through HTTP calls.
👇🏻
Each service will have their own codebase (Ex: separate Github repositories for each service), deployment pipeline, host URL and other dependent resources.
👇🏻
Monolith Architecture:
(Monolithic architecture is something that build from single piece of material, historically from rock. Monolith term is normally used for an object made from single large piece of material)
👇🏻
In Monolith architectural style the whole application is built as a single service with a single codebase which includes different components of the application.
👇🏻
In the below example all the three Catalog Service, Order Service & Payment Service are present in a single service including end user applications like website, mobile app etc.
All the data is kept in a single database as well.
👇🏻
Although micro services architecture is proving to be more popular these days, this is not a silver bullet architecture that everyone should follow.
Each of these architectures have their advantages and disadvantages. Let's discuss about them next:
👇🏻
Advantages of Micro Services Architecture:
1⃣ Fault Isolation: Even if there's an issue in a single service all the other services will remain unaffected and continue to work normal. Whereas in a monolith the whole application will be affected.
👇🏻
2⃣ Development Flexibility: Individual Services can be developed using different languages. One service can be developed in GoLang, another is Python/Django etc. But in case of Monolith the whole application should use a single Language / Framework.
👇🏻
3⃣ Faster Deployments: Smaller codebase will result in faster deployments & easy to maintain.
4⃣ Scalability: Individual services can be scaled separately based on the demand. In our example Inventory Service can have more number of tasks running than other services.
👇🏻
Disadvantages of MicroServices Architecture:
1⃣ Communication: Having too many micro services can make communication between them complex and also it adds to the overall latency since communication between different services is a HTTP call.
👇🏻
2⃣ Resources: More services means more resources.
3⃣ Testing & Debugging: Since there are many components involved, testing and debugging can become difficult.
👇🏻
4⃣ Deployment: On the one hand micro services architecture simplifies the deployment of individual services. On the other hand any end to end feature needs deployment of all the services and it can add complexity to the process.
👇🏻
I hope the Micro Services Vs Monolith Architecture is clearer to you now. Feel free to add any more information I may have missed.
Consider subscribing to my blog if you like this thread:
Do you want to start making money through Freelancing but struggling to get started?
Here are some tips for you to get started and grow from there:
🧵👇🏻
Most people struggle to get their first freelancing task. I used to think I may never be able to earn any money through freelancing with my skills (until last year).
But freelancing is not difficult at all!
You just have to go through the barrier of getting that first task.
👇🏻
Once you complete your first task, there's no stopping you.
Know that even 👉🏻 YOU can make a lot of money through freelancing!
Here are some tips to land your first task and how to grow from there: