Service discovery patterns
Discovery is the counterpart of service registry from the view of clients. Whenever a client wants to access a service, it must find details about the service, where it is located, and other contract information. This is typically done using two approaches, client-side discovery and server-side discovery. Service discovery can be briefly summarized as follows:
- Microservices or consumers don't have any prior knowledge about the physical location of other services. They don't know when a service goes down or another node of the service is going up.
- Services broadcast their existence and disappearance.
- Services are able to other service instances based on other broadcasted metadata.
- Instance failures are detected and any request to that failed node is prevented and is made invalid.
- Service discovery is not a single point of failure.
In this section, we will both look at the patterns of service discovery and understand the pros and cons of each pattern.