Service Registry and Discovery

How to identify the network location of the running instance of Microservices? This problem arises because the service instance changes dynamically to meet auto-scaling, failures, and upgrades.

Solution is by using Service Discovery and Registry

Service Registry

It is a database having the information of available services like the network location of service instances. There are two ways to register a service:
  • Self- registration, where service instance register itself whenever it is start-up/available and de-register whenever its shutdown or going-down.
  • Third party registration, which is a common practice in industry where registering or de-registering the service instance is delegated to Service manager.

Point to be considered:

  • Service Register should be highly available.
  • Plan for a cluster of registries that uses replication to maintain consistency.
  • Never cache service instance network location as its dynamic.

Client Side and Server Side Discovery

In client side discovery approach, client is responsible for interacting with service registry to fetch the network location of a service and then make a request to the service while in Server side discovery, the client makes a request and API Gateway interacts with service registry to identified the network location of service.
Please share this

Leave a Reply