Service Registry Pattern

In this article, we are going to talk about Design Patterns of Microservices architecture which is The Service Registry Pattern. As you know that we learned practices and patterns and add them into our design toolbox. And we will use these pattern and practices when designing microservice architecture.

By the end of the article, you will learn where and when to apply Service Registry Pattern into Microservices Architecture with designing e-commerce application system with following KISS, YAGNI, SoC and SOLID principles.

Step by Step Design Architectures w/ Course

I have just published a new course — Design Microservices Architecture with Patterns & Principles.

In this course, we’re going to learn how to Design Microservices Architecture with using Design Patterns, Principles and the Best Practices. We will start with designing Monolithic to Event-Driven Microservices step by step and together using the right architecture design patterns and techniques.

Service Registry Pattern

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 that, we have added API Gateways for routing the traffic with client and internal microservices. But How API GWs access the internal backend microservices ? How 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 the several services on the different server. Due to dynamically changes in the ips and port numbers of these services, it is much more difficult to manage service discovery operations.

You can see the image and see how its solved, Basically there will be 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 need 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 available for spring boot java applications.

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

Design — Service Aggregator Pattern — Service Registry Pattern — Microservices Communications Design patterns

You can find example implementation of Service Registry Pattern for our e-commerce architecture.

As you can see that we have applied Service Aggregator Pattern — Service Registry Pattern for our e-commerce architecture.

So we should evolve our architecture with applying new microservices patterns in order to accommodate business adaptations faster time-to-market and handle larger requests.

Step by Step Design Architectures w/ Course

I have just published a new course — Design Microservices Architecture with Patterns & Principles.

In this course, we’re going to learn how to Design Microservices Architecture with using Design Patterns, Principles and the Best Practices. We will start with designing Monolithic to Event-Driven Microservices step by step and together using the right architecture design patterns and techniques.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mehmet Ozkaya

Mehmet Ozkaya

Software/Solutions Architect, Udemy Instructor, Working on Cloud-Native and Serverless Event-driven Microservices Architectures https://github.com/mehmetozkaya