For making a request to a service a client must know its ip and port but in microservices architecture the number of instances of a service can dynamically change (scale up/scale down) based on load on a service . Therefore the service instances have dynamically assigned network location. For this reason service discovery mechansim is required to enable client and service interaction. Note that like a load balancer in a horizontally scalable monolithic architecture the service registry (which is a key component of service discovery mechanism) is avaliable on static ip or through domain name.

Service discovery is achieved service registry which is a database of network locations of service instances. The service instances must be added /removed from service registry as the number of service instances increase / decrease to manage the variation in load the service is experiencing.For service discovery to work