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.

Similar Reads

What’s Service Discovery in Microservices?

Suppose we have Service-A & Service-B and we have our Load Balancer placed inside a different server. Now let’s introduce our Discovery Service. Now what this discovery service will do now whenever Service-A and Service-B want to communicate with each other then whenever we are starting our Microservices we’ll be registering them with Discovery Service. And this discovery service right now will know what is the IP and port number of Service-A and what is the IP and port number of Service-B. All detailed information will be there with Discovery Service. Similarly, if we have many different instances of Service-B, all this Service-B which is running in different servers will be registering their information with Discovery Service. So it is one central location where we’ll be managing our host and the port number information inside this particular server. This is basically called registration because all the services whenever they are starting off they are registering themselves with the discovery service and now the discovery service is maintaining all their information inside a particular map or a list or a database. We called it a Service Registry....

Types of Service Discovery

There are two types of Service Discovery...

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....