Overview

Server-side Discovery is a service discovery approach where the responsibility for querying the Service Registry and determining which instance to route a request to is handled by a dedicated routing service — not by the client making the request. It works in combination with the Service Registry and a registration pattern (Self-registration or 3rd Party Registration).

Problem

Each client or service that needs to invoke another service must somehow discover its current network location. If every client is responsible for querying the Service Registry and performing load balancing itself (client-side discovery), this logic must be duplicated across every service and every language/framework used. How can this complexity be centralised?

Solution

With Server-side Discovery, the routing service takes on the responsibility of performing the Service Registry lookup and load balancing. The client simply sends its request to the routing service by name, and the routing service resolves the actual instance location and forwards the request.

External Clients

As described in the API Gateway pattern, requests from outside the firewall are directed to a service with the responsibility of routing requests — typically the API Gateway. The routing service performs the Server-side Discovery logic: it queries the Service Registry by service name, then uses load balancing mechanisms to determine which instance to route the request to.

Internal Service Communication

When communication occurs between services within the firewall, it is not necessary to go through the routing service. Instead, the approach consists of the services themselves making a request to the Service Registry to obtain the location of the instances of the service they require, and then directing their request accordingly.

Technologies

Deployment platforms such as Docker and Kubernetes implement the Service Registry, Server-side Discovery, and request routing using the 3rd Party Registration approach. Using this type of technology means all the approaches described above are guaranteed by the deployment platform, removing that responsibility from the developer.

Trade-offs

Benefits

  • Discovery and load balancing logic is centralised — clients are simpler and do not duplicate registry logic
  • Works transparently for clients across different languages and frameworks
  • Deployment platforms (Kubernetes, Docker) provide this automatically

Drawbacks

  • Increased complexity — additional components to develop, maintain, and deploy
  • Additional network hops — each request requires a registry lookup, though the increased response time is insignificant compared to the advantages this approach provides

When to Use

Apply Server-side Discovery when:

  • You want to avoid duplicating discovery and load balancing logic in every client service
  • Services are implemented in multiple languages or frameworks
  • You are using a deployment platform like Kubernetes — it provides this automatically