Microservices. What is difference between Service registry and service discovery
Asked Answered
P

2

13

I am new to Microservices. I came across terms Service registry and service discovery.

What I understood is when a new service (or service instance) comes up, then it will register itself with the "service registry". It is also mentioned that the client can contact a service registry and get the list of IP-ports where that service is available.

In that case, what is the role of "service discovery".

Edit

Accepted answer. Also, more theoretical details were found https://www.nginx.com/blog/service-discovery-in-a-microservices-architecture/

Puffery answered 14/6, 2017 at 9:18 Comment(0)
K
16

End to end process of registering services to a central place and reaching out to target service using service registry is service discovery.

This is pretty much like using DNS for finding IP address of a site and then reaching that site using the IP address.

I am a user of Kubernetes and it also talks on similar lines: https://kubernetes.io/docs/concepts/services-networking/service/#discovering-services

In short, service discovery is not a module with the specific role but the steps involved in connecting from serviceA to serviceB end-to-end.

Kirshbaum answered 14/6, 2017 at 9:32 Comment(0)
G
3

t;dr: Service Discovery is used when the client doesn't know what service they want at first, so they start by asking for a list of services that are available.

Disclaimer: I suspect that the term is used in different ways by different systems. So take the textbook answer I give here with a grain of salt.


In general, service registry systems follow a Broker Pattern (or something similar), and fall into two categories:

  1. White-pages brokering: clients know exactly what service they're looking for and ask for it by name

  2. Yellow-pages brokering: clients know what kind of service they need performed, but they don't know the exact service that they want

Both systems connect clients to services, and both involve services that use a Register Pattern to enter themselves into the registry.

But yellow-pages systems require a preliminary Service Discovery step. In the Service Discovery pattern,

  • The client first asks for a list of services from the broker.
  • The client selects a service from the list.
  • The client requests a connection to a service from the list.

Diagram from Gomaa

Image source: Hasan Gomaa, Software Modeling & Design (Cambriduge University Press, 2011), p. 283.

Geneticist answered 9/5, 2019 at 1:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.