Skip to main content

Service Discovery Pattern

Learn Service Discovery Pattern (Core Microservices Patterns, Microservices Design Patterns) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

The Problem In a microservices system, service instances come and go constantly - they scale up/down, crash and restart, or get redeployed with a new IP address. Hardcoding http://192.168.1.5:8081 for the Order Service into every caller breaks the moment that instance moves. What is Service Discovery? • A mechanism that lets services find each other's current network location dynamically , without hardcoded addresses. • A Service Registry (e.g. Eureka, Consul) keeps a live list of "service name -> healthy instance addresses." • Each service instance registers itself on startup and sends...

More lessons in Core Microservices Patterns