A service registry is a continuously updated database that records which service instances are running, where they listen and whether they are healthy, so that other components can find them by name instead of by hard-coded address. Within Services & processes on modern servers, it is the authoritative source of truth behind service discovery, connecting long-running processes, containers and virtual machines that start, stop and move across hosts.
Each entry typically holds a service name, host address, port, health status and metadata such as version or data center. The registry itself does not route traffic; it answers the question where a service currently lives, and clients, proxies or load balancers act on the answer.
How a service registry tracks instances
A service registry tracks instances through a lifecycle of registration, health checking and deregistration. When a worker process or container starts and binds its port, it announces itself, either directly or through an agent. The registry stores the entry and marks it as available only after it passes its first health check.
Liveness is maintained in one of two ways. With heartbeats or leases, the instance must renew its entry every few seconds, and the registry expires entries whose time to live (TTL) lapses. With active health checks, the registry or a local agent probes an HTTP endpoint, a TCP port or a script and changes the status after a configured number of failures.
On a graceful shutdown, a well-behaved instance deregisters before closing connections, so clients stop receiving its address while in-flight requests finish. A crashed or hung process cannot do this, which is why expiry and health checks are essential safeguards.
The table below describes the fields a typical registry entry contains.
| Field | Example value | Purpose |
|---|---|---|
| Service name | orders-api | Logical name clients look up |
| Instance ID | orders-api-7f3c | Distinguishes replicas of one service |
| Address and port | 10.0.4.12:8080 | Network endpoint to connect to |
| Health status | passing, warning, critical | Filters out unhealthy instances |
| Metadata and tags | version=2.3, zone=b | Supports routing and canary releases |
| TTL or lease | 10-30 seconds | Removes entries that stop renewing |
Registration and discovery patterns
Registration and discovery can each be performed by the service itself or by surrounding infrastructure, and the combination shapes how much code each application needs. In self-registration, the application calls the registry API on startup and sends heartbeats. In third-party registration, a process supervisor, orchestrator or sidecar agent observes the instance and registers it on its behalf.
On the consuming side, client-side discovery means the caller queries the registry and picks an instance itself, while server-side discovery places a load balancer or proxy in front that performs the lookup. Many platforms also expose the registry through DNS, which works with unmodified clients but inherits DNS caching delays.
| Pattern | Who does the work | Main advantage | Main drawback |
|---|---|---|---|
| Self-registration | Application code | No extra components | Couples code to the registry |
| Third-party registration | Supervisor or agent | Applications stay unaware | Another component to operate |
| Client-side discovery | Calling service | Smart, local load balancing | Logic repeated per language |
| Server-side discovery | Proxy or load balancer | Simple clients | Extra network hop |
| DNS-based discovery | DNS resolver | Works with any client | Stale answers from caching |
Consistency, availability and common implementations
A service registry is itself a distributed system, so its designers must choose how it behaves during a network partition. Strongly consistent registries built on consensus protocols such as Raft refuse writes without a quorum, which guarantees a single view of membership but can block registration during outages. Availability-oriented registries keep answering from local replicas and reconcile later, accepting that some answers may be briefly stale.
Neither choice is universally correct. For discovery, a slightly stale list of mostly healthy endpoints is usually better than no answer, which is why many deployments combine a consistent store with client-side caching of the last known good list.
| Implementation | Consistency approach | Typical setting |
|---|---|---|
| Consul | Raft consensus plus gossip | Mixed VM and container estates |
| etcd | Raft consensus | Kubernetes control plane |
| Apache ZooKeeper | ZAB consensus protocol | Older JVM-based clusters |
| Eureka | Availability first, peer replication | Spring-based microservices |
| Kubernetes Endpoints | Backed by etcd | Pods behind cluster services |
Service registry versus related concepts
The service registry is often confused with neighboring ideas because they appear together in the same architecture. Service discovery is the overall process of finding endpoints, and the registry is the data store that makes discovery possible. A load balancer distributes requests among endpoints but needs a registry or static list to know them.
A process supervisor such as Supervisord or PM2 keeps a process alive on one host, whereas the registry publishes where processes are reachable across many hosts. A service dependency map describes which services call which, while the registry records only the current location and health of each instance.
Operating a registry reliably
Because every lookup depends on it, the registry becomes a critical shared dependency and must be run with at least three or five nodes for quorum-based systems. The following problems appear most often in production.
| Symptom | Likely cause | Fix |
|---|---|---|
| Traffic sent to dead instances | TTL too long or no health check | Shorten TTL and add active checks |
| Healthy instances flapping out | Overly strict check thresholds | Require several consecutive failures |
| Errors during deployments | No deregistration on shutdown | Deregister before draining connections |
| Cluster refuses registrations | Lost quorum | Restore nodes, keep an odd node count |
| Clients see old addresses | Aggressive DNS caching | Lower DNS TTL or use API lookups |
Health checks should test what clients actually need, such as a lightweight endpoint that verifies critical dependencies, rather than merely confirming that a port is open. Securing the registry with access control and encrypted transport is equally important, because a forged entry can redirect production traffic.
A non-technical view
A service registry works like the live directory board in a large office building. Teams move between floors and rooms all the time, so visitors do not memorize room numbers. They check the board, which always shows where each team sits today.
When a team moves in, its name goes up on the board. When it leaves, or stops answering its door, the entry comes down. Everyone else simply asks the board, so moves and closures do not leave visitors knocking on empty rooms.
A concrete example
An online retailer runs its checkout as a set of small services across twelve virtual machines. The payment service has four instances, each registering itself with a three-node registry cluster and exposing a health endpoint that the local agent checks every ten seconds.
During a rolling restart, each payment instance first deregisters, waits 15 seconds for open requests to finish and then restarts. The checkout service queries the registry before each call and caches the answer for five seconds, so it never sends requests to an instance that is restarting.
One night, a payment instance hangs after a memory leak. Its health check fails three times in a row, the registry marks it critical and traffic shifts to the remaining three instances within about 30 seconds. Customers notice nothing, and the on-call engineer investigates the hung process the next morning.