Server Side Service Discovery in Microservices
So, the example we have taken above we call it as Server-Side Discovery. The entire concept is called a Server-Side Discovery. Why so? Let’s understand it step by step.
- Step 1: The client (Service-A) makes a request to a server that is it may be a Router, Load Balancer, or Middleman. In this case, it’s a Load Balancer.
- Step 2: The server (Load Balancer) does a query with a Discovery Service.
- Step 3: The Discovery Service responded back with available numbers of instances of Service-B that the Load Balancer can call.
- Step 4: Then the Load Balancer server picks up one of the Service-B instances and makes a call.
- Step 5: Here the Service-A(Client) doesn’t talk to the Discovery Service directly. It calls another server (Load Balancer) which helps to discover Service-B URL info.
And this complete pattern we called Server Side Discovery.
Advantages: In this approach, the Load Balancer does the job of load balancing. This is the major advantage of this approach. Undoubtedly, developing this level of abstraction makes the Service Consumer more lightweight, as it doesn’t have to deal with the lookup procedure. So there’s no need to implement the discovery logic individually for each language and framework that the Service Consumer uses.
Disadvantages: The disadvantage is we must set up and operate the Load Balancer unless it’s already given by the deployment environment.
Example:
- NGNIX: Nginx is a web server that can also be used as a reverse proxy, load balancer, mail proxy, and HTTP cache. Nginx is a free and open-source software.
- AWS ELB: Elastic Load Balancer (ELB) is a service provided by Amazon in which the incoming traffic is efficiently and automatically distributed across a group of backend servers in a manner that increases speed and performance. It helps to improve the scalability of your application and secures your applications.
Server Side Service Discovery in Microservices
Microservices are small, loosely coupled distributed services. Microservices architecture evolved as a solution to the scalability, independently deployable, and innovation challenges with Monolithic Architecture. It provides us to take a big application and break it into efficiently manageable small components with some specified responsibilities. It is considered the building block of modern applications. Before understanding What is Service Discovery let’s understand what is the need for Service Discovery in Microservices.