Microservice Has Almost Become the First Choice to Design a Scalable Backend Architecture
Here's a Six Simple Steps to Understand it as a Beginner:🧵👇
Here's a Six Simple Steps to Understand it as a Beginner:🧵👇
1. What is a Microservice?
- Big monolith application is divided into various independent modules
- These modules are developed, tested & deployed independently as a separate service
- And these individually deployed services are called microservices
- Big monolith application is divided into various independent modules
- These modules are developed, tested & deployed independently as a separate service
- And these individually deployed services are called microservices
2. Service Discovery
- Imagine it as a phone book where contact information of all microservice is added
- Based on the request, the gateway service finds the appropriate microservice by using the service discovery
- Imagine it as a phone book where contact information of all microservice is added
- Based on the request, the gateway service finds the appropriate microservice by using the service discovery
3. Gateway Service
- It acts as an external wrapper to all microservices
- It is a single door to communicate to all microservices
- Request from frontend always comes to the gateway service
- It performs authentication checks, & other security-related checks, etc
- It acts as an external wrapper to all microservices
- It is a single door to communicate to all microservices
- Request from frontend always comes to the gateway service
- It performs authentication checks, & other security-related checks, etc
- Later forwards it to the respective microservice using service discovery
- The microservice process the request, and send a response back to the gateway service and it is forwarded to the client
- The microservice process the request, and send a response back to the gateway service and it is forwarded to the client
4.a. Explanation of the Above Diagram
1) Request from front-end, goes to API gateway
2) API gateway performs authentication & other checks and asks Service discovery for the address of the respective microservice
3) Request goes to microservice
1) Request from front-end, goes to API gateway
2) API gateway performs authentication & other checks and asks Service discovery for the address of the respective microservice
3) Request goes to microservice
4) Microservice communicates to DB (if required) and then computes the response.
5) Response is sent to the API gateway
6) API gateway adds any additional headers (if required) to the response and sends it to the client.
5) Response is sent to the API gateway
6) API gateway adds any additional headers (if required) to the response and sends it to the client.
5. Benefits of Microservice
- It is highly scalable, maintainable and modular in nature
- Based on the need in a specific module we can use an altogether different tech stack. Hence use different programming languages as per their strength in one product. i.e. Java with Python
- It is highly scalable, maintainable and modular in nature
- Based on the need in a specific module we can use an altogether different tech stack. Hence use different programming languages as per their strength in one product. i.e. Java with Python
6. When to choose it?
- When your application is very complex
- When you need to selectively scale different modules of your application.
- You want to use different programming languages to their strength.
- When your application is very complex
- When you need to selectively scale different modules of your application.
- You want to use different programming languages to their strength.
This was just the tip of the iceberg, I'll be putting more content on this in my upcoming threads
Follow me
@vikasrajputin to stay updated
Every Mon, Wed & Friday - I tweet a thread on Backend Development.
Follow me
@vikasrajputin to stay updated
Every Mon, Wed & Friday - I tweet a thread on Backend Development.
Before you go, do you know?
I've also started writing on LinkedIn
I share some exclusive content there, which I never share here.
Follow me on Linkedin to stay updated with Backend content:
linkedin.com
I've also started writing on LinkedIn
I share some exclusive content there, which I never share here.
Follow me on Linkedin to stay updated with Backend content:
linkedin.com
جاري تحميل الاقتراحات...