Service Registry Pattern


Service Registry Pattern

In this tutorial, we are going to talk about Design Patterns of Microservices architecture which is the Service Registry Pattern. We will use this pattern and practice when designing microservice architecture.

We can use Microservice Discovery Patterns and Service Registry for explaining this pattern. As the name suggests it will provide to register and discover microservices in the cluster.

As you know, we have added API Gateways for routing the traffic with the client and internal microservices. But How do API GWs access the internal backend microservices? How do API Gateways know the target IP and port numbers for backend microservices?

In that stage, the solution is applying Service Registry Pattern. Because, in a Microservices-based application, we have many instances of several services on the different servers. Due to dynamically changes in the IPs and port numbers of these services, it is much more difficult to manage service discovery operations.

Service Registry Pattern

You can see the image and see how it’s solved, Basically, there will be a new service for handling Service Registry, so the client service finds the location of other service instances by querying a Service Registry.

And of course, internal backend microservices should register to Service Registry service before. So we can say that The Service Registry is a database for microservice instances. When the client service needs to access internal services, then it will query from Service Registry and access them.

There are some open-source Service Registry implementations like Netflix provides a service discovery pattern called “Netflix Eureka” and is available for spring boot java applications.

But nowadays, this pattern is not required to implement because the container orchestrator systems automatically handle service discovery operations themselves. For example, Kubernetes has Service definitions that basically perform all these tasks after the definition of services on K8s. So it’s not a big deal now, but it’s good to know the underlying pattern of these Microservice Discovery Patterns and Service Registry operations.

Service Registry Pattern

Scroll to top