In this section, we will see the need for service discovery and the need for the service registry and try to understand the difference between service registry and discovery. We already have some of our shopping cart microservices set ups, but with core dependency on a network location that was static. Our code reads a value from a configuration file and on any change in the location of a service, we update it in our configurations. In the practical world, it is very difficult to maintain this as service instances are dynamically assigned locations. Moreover, service instances change dynamically based on the needs for autoscaling, failure handling, and updating process that is abstracted from a consumer client in the microservice world. Hence, clients need to use a more enhanced service discovery mechanism.
Service discovery can be defined as:
A complete end to end process of registering services in a central place (API Gateway or database) and reaching...