Service discovery
All the APIs exposed by a microservice are accessible via the IP address and port of the host machine on which the microservice is deployed. Since microservices are deployed in a virtual machine or a container that has a dynamic IP, it is quite possible that the IPs and ports that are allocated to the microservice APIs may change over time. Therefore, IP addresses and ports of services should never be hardcoded by the depending microservice. Instead, there should be a common database of all the services that are active for the current application. Such a database of services is called the service registry in microservices architecture and is always kept up to date with the location of the microservices. It keeps the details of all the active microservices including their current IP address and port. Microservices then query this service registry to discover the current location of the required microservices and connect to them directly.