In a Microservices architecture, Services are dynamic, distributed and present in large numbers. It is needed to have a good Service discovery solution to address this dynamic problem. In this blog, I will cover basics of Service discovery and using Consul to do Service discovery.
What is Service discovery?
Service discovery should provide the following:
- Discovery – Services need to discover each other to get IP address and port detail to communicate with other services in the cluster.
- Health check – Only healthy services should participate in handling traffic, unhealthy services need to be dynamically pruned out.
- Load balancing – Traffic destined to a particular service should be dynamically load balanced to all instances providing the particular service.
Following are the critical components of Service discovery: