Service Discovery 00:00:01 Find a kitchen after its address changes A dispatch desk needs the kitchen named user-service, and the kitchen's machines may move. A registry connects a stable service name to currently eligible endpoints. Discovery and routing are related but different jobs. User A and user B tell the registry their name and address, and their first checks pass. Two instances, two healthy, none unhealthy. The caller keeps the list for 30 seconds. Round robin, index 0: the first address. 200 after 45 ms, as an example. The next call takes index 1, user B, without a new lookup. This example uses a client-side endpoint list. The registry supplies candidates, a local policy selects one, and the application still has to handle an address that stops working after selection. 00:00:52 Put the address book behind the switchboard With server-side discovery the caller contacts a stable front door. A load balancer learns candidate kitchens and chooses one per request. The caller no longer has to embed that selection logic itself. The registry sends the list of healthy instances to the load balancer. The order service calls user-service. It has no list and no library. User A stops answering. The balancer notices after a few failed checks. Calls go to B and C. The caller did not change. The front door now has its own capacity, availability and configuration propagation requirements. Discovery has shifted where knowledge lives, while failed endpoint calls remain possible. 00:01:35 The address book still lists yesterday's kitchen A kitchen dies just after a heartbeat. The registry needs time to detect the loss, and a client might have cached the old list just before the update. Two freshness delays can overlap. It had just sent a heartbeat. Nobody knows. One call in three goes to a dead address. Three heartbeats are missing. The registry drops B, but the caller refreshed a moment ago and keeps its old list. The caller asks again and gets two addresses. Use measured detection, propagation and cache time to estimate exposure. Add bounded timeouts and safe retries where suitable. Aggressive health checks can also misclassify a temporarily slow kitchen. 00:02:15 Close the kitchen without dropping in-progress orders Bring the new instance online and wait for readiness. Stop advertising the old instance before terminating it, then allow time for endpoint updates, old connections and active requests to drain. User C starts with the new version and joins after its check has passed. It deregisters, but it keeps working. After the expected refresh window, well-behaved callers have a list without the old endpoint. Check outstanding connections before shutdown. It finishes its open requests and exits. The thirty seconds in this example is a configured assumption. Real clients, resolvers and long-lived connections do not share a perfect clock. Verify draining from actual request traces. 00:02:58 A bad health check removes every kitchen Three healthy application instances probe one shared database. Its outage makes all three fail readiness together, including paths that could have served a cached response. The address book becomes empty. Three instances, each with a check that also queries the shared database. All three checks fail in the same minute. The balancer has no target. Even answers from a cache are refused. The check asks only whether this instance can work. Requests that need the database fail, and the others are served. Define readiness around the traffic an instance can safely serve, and expose downstream degradation separately where practical. A registry can distribute a decision quickly, including a badly chosen decision.