← Lessons

quiz vs the machine

Silver1100

System Design

The Service Registry

A directory where services register and others discover live instances.

4 min read · intro · beat Silver to climb

Finding services dynamically

In a dynamic fleet, instances start, stop, and move constantly. Hardcoding addresses breaks immediately. A service registry is a directory where each instance registers itself and callers look up healthy instances by name.

Register and discover

  • On startup, an instance registers its address and a service name.
  • It sends heartbeats so the registry knows it is alive.
  • A caller queries by name and gets a list of healthy addresses to call.

Keeping it fresh

If an instance crashes and stops heartbeating, the registry deregisters it after a timeout so callers stop routing to a dead address. This self healing is what makes discovery reliable.

Key idea

A service registry is a live directory of healthy instances, kept fresh by heartbeats, so callers always discover reachable addresses by name.

Check yourself

Answer to earn rating on the learn ladder.

1. Why does a service registry rely on heartbeats?

2. What does a caller get from the registry?