In the server-side discovery pattern, the client isn't aware of the Service Registry. The client service requests a service using a load balancer, which then queries the Service Registry.
The AWS Elastic Load Balancer (ELB) is one example of server-side discovery. It is commonly used as a load balancer for external traffic from the internet. It manages the load between a set of registered Amazon Elastic Compute Cloud (EC2) instances or Amazon EC2 Container Service (ECS) containers. Other examples include HTTP servers and load balancers such as NGINX Plus.
In the server-side service discovery pattern, the client doesn't need to worry about managing the code or algorithm for load balancing and discovering services. Instead, we can use a separate load balancer server.
The following diagram illustrates server-side service discovery:
As you can see in the preceding diagram, this approach uses a Load Balancer server that is separate from the client service. The client service makes a request directly to the load balancer, which queries the Service Registry and then finds a service.
The server-side service discovery pattern has various advantages and disadvantages. Some of the advantages include the following:
In this approach, the client service doesn't require the complex logic of searching for services or load balancing traffic
There is no need to implement discovery logic for each programming language and framework used by a service client
Some cloud environments, such as AWS Elastic load balancer, provide this functionality for free
This approach also has the following disadvantages:
The load balancer needs to be a highly available system, so you have to set it up and manage it carefully
The load balancer could be a single point of failure, so it needs to be replicated for availability and capacity
The load balancer server must support important protocols such as HTTP, gRPC, and Thrift
It has more network rounds than the client-side service discovery pattern