What is Server side Service Discovery in the Microservices
In this tutorial, we are going to learn about Server side Service Discovery in the Microservices.
- The client microservices connects to a service registry via a load balancer. So there is a load balancer between the client microservices and the service registry.
- The load balancer queries the service registry and routes the traffic to the target microservices and performs the load balancing.
- If you look at the below image, the instances on the right side are up, they put their IP in the service registry and the client microservices on the left side wants to find them, so it has to make the API call to the load balancer, and it looks up the service registry and finds all the existing instances and then performs that load balancing.
- For example, load balancer does round-robin and then makes sure that the load is distributed across all instances.
- One real time example is that in Amazon Web Services. We have something called Elastic Application Load Balancer which has a target group behind it and then all the instances whether there are instances of EC2 or virtual machine or containers running in fire gate they attach themselves to their target group.
- So the Target Group acts as a service registry and client microservice wants to make an API call, and it sends the API call to the IP address or DNS name of the Elastic Application Load Balancer Elastic Application.
- Load Balancer directs the traffic to a target group, and Target Group has a list of the attached microservices and receives the traffic based on their load balancing a strategy.