When you run hundreds or thousands of microservices, it is a requirement to have a central place to get the details of services .That’s where service registry and discovery come into the picture.
Service owners should register the service at the service registry so that the consumers can discover them. Also, the owners are responsible for updating and maintaining the information of services. The most commonly practiced use cases for service registry and discovery in a microservices architecture is to have addressable names for services that make them independent of the infrastructure that they are running on.
For example, when we are doing a service call, we use a name with a logical reference to the service and the service discovery resolves that name to the actual endpoint address of the service. Therefore, external services or consumers do not need to change their code when there’s a change in the actual endpoint address.
There are two ways of implementing service discovery:
Client-side discovery is commonly used when the client is fully aware of the existence of the service registry and client code contains the service discovery logic.
Server-side discovery is often used with container management systems such as Kubernetes and Docker Swarm, where service discovery is transparent to the client side.
Quick Links
