QA
Intermediate LevelSystem Design & Architecture

How does Service Discovery (HashiCorp Consul, Netflix Eureka) locate dynamic microservice instances?

❓ Interview Prompt: Explain Service Discovery, Service Registry, Client-Side Discovery vs Server-Side Discovery, and dynamic IP routing.

In auto-scaling cloud environments, microservice container IP addresses change continuously. Service Discovery tracks dynamic instance locations:

2 Discovery Patterns:

1
Client-Side Discovery: Client queries the Service Registry (Consul/Eureka) directly to fetch active node IPs and executes load balancing locally.
2
Server-Side Discovery: Client sends requests to a Router/Load Balancer. The router queries the Service Registry and forwards traffic to an active node IP.

Code Implementation Example

json
{
  "serviceName": "payment-service",
  "activeInstances": [
    { "id": "inst-1", "ip": "10.0.1.45", "port": 3000, "health": "PASSING" },
    { "id": "inst-2", "ip": "10.0.2.89", "port": 3000, "health": "PASSING" }
  ]
}
πŸ’‘Consul Service Registry active instance payload.
🎯 Interview Key Takeaway

Use Service Discovery to map microservice names to dynamic container IP addresses automatically.

#System Design#Service Discovery#Consul#Eureka#Intermediate
Back to all System Design & Architecture Questions→

More System Design & Architecture Interview Questions

Beginner LevelSystem Design & Architecture

Explain the CAP Theorem and PACELC Theorem with real-world database examples.

Beginner LevelSystem Design & Architecture

What is Vertical Scaling (Scale Up) vs Horizontal Scaling (Scale Out)?

Beginner LevelSystem Design & Architecture

How do Load Balancers distribute traffic (Round Robin, Least Connections, IP Hash)?