Untitled Lesson
Skill Matrix
UNLOCK NODES BY LEARNING NEW TAGS.
What is the key difference between client-side and server-side service discovery?
💻 Code Challenge | +75 XP
Write a client-side discovery function that queries a mock service registry for healthy instances of "order-service" and selects one using round-robin selection across successive calls.
An intermittent production error shows requests occasionally failing with connection refused, traced to a hardcoded IP address for a downstream service that was rescheduled to a new machine. Reorder the steps to fix this properly.
Task: Reorder the blocks in logical sequence to solve the problem.
A.D.A. Interface
Adaptive Didactic Assistant

Pascual Vila
Frontend Instructor // Code Syllabus
The Error //
Hardcoding a downstream service's IP address or hostname directly in application code
// Wrong: breaks the moment this specific instance is rescheduled
const url = "http://10.0.1.47:3000/orders";
// Correct: stable name, resolved dynamically to a healthy instance
const url = "http://order-service/orders";The Solution //
In any environment where service instances are dynamically created, destroyed, or rescheduled (containers, orchestrated deployments), a hardcoded address becomes stale as soon as the underlying instance changes, causing connection failures. Use a stable DNS name or service registry lookup that's automatically kept current, instead of a fixed address.
The Error //
Registering a service instance in a discovery registry without any accompanying health check
// Wrong: registered, but no way to detect it becomes unhealthy later
registry.register({ name: "order-service", address: myIp });
// Correct: health check gates continued eligibility for traffic
registry.register({ name: "order-service", address: myIp,
check: { http: "/health", interval: "10s" } });The Solution //
A registry entry that only tracks whether an instance exists, without verifying it's actually healthy and responsive, can route traffic to an instance that's technically running but broken (e.g. lost its database connection). Health checks must gate whether an instance is eligible to receive traffic, not just whether it's registered.