Overview

In modern microservices environments, service instances are frequently created and destroyed. Dynamic service discovery allows services to find each other without having hard-coded IP addresses.

Key Components

  • Service Registry: A database containing the network locations of service instances (e.g., Consul, Etcd).
  • Registration: When a service starts, it tells the registry its location.
  • Querying: When a service needs to call another, it asks the registry for a list of healthy instances.

Patterns

  • Client-Side Discovery: The client is responsible for querying the registry and load balancing.
  • Server-Side Discovery: The client calls a load balancer, which queries the registry and routes the request.