Service Discovery

Client-side vs server-side discovery, service registries (Consul, Eureka, etcd), and health checking strategies.

Overview

Overview In a microservices architecture, services are deployed across multiple hosts and containers, often scaling up and down dynamically. Service discovery is the mechanism by which one service finds the network location (IP address and port) of another service it needs to call.

Without service discovery, you would hardcode IP addresses or maintain static configuration files — both of which break instantly in elastic cloud environments. Service discovery automates this process, enabling services to register themselves when they start, deregister when they stop, and query the registry to find each other.

Interviewers probe this topic to test your understanding of distributed systems coordination. Key discussion points include consistency of the registry (CP vs AP), health checking strategies, and the difference between client-side and server-side discovery patterns.

Key concepts

  • Client-side discovery pattern
  • Server-side discovery pattern
  • Service registry (Consul, Eureka, etcd)
  • Health checking and heartbeats
  • DNS-based discovery
  • Self-registration vs third-party registration
  • Load balancing integration

Interview questions

  • What is the difference between client-side and server-side service discovery?
  • How do service registries maintain consistency and handle failures?
  • How does service discovery work in Kubernetes?
  • How do you handle service discovery in a multi-region or hybrid cloud deployment?

Sign up free to read the full topic

More Microservices topics

Start free on Cariara · Coding problems · System design studio