How do microservices find and communicate with each other in a dynamic environment, and what is the difference between client-side and server-side discovery?
Last updated
Instances are ephemeral with changing IPs, so services look up locations in a service registry instead of hardcoding addresses.
Client-side discovery: the client queries the registry and load balances itself (fewer hops, but logic in every client), e.g.
Eureka+Ribbon.Server-side discovery: the client calls a fixed router/load balancer that queries the registry and forwards (dumb clients, but an extra hop that must be highly available), e.g. Kubernetes
Service.
- https://devcookies.medium.com/service-discovery-in-microservices-a-detailed-guide-dc5184777508
- https://designgurus.substack.com/p/system-design-deep-dive-client-side
- https://www.cerbos.dev/blog/service-discovery-load-balancing-microservices
- https://www.geeksforgeeks.org/java/service-discovery-and-service-registry-in-microservices/