A registry: one name, the instances alive right now
Three jobs: register each instance once ready, look up the healthy ones by name, and remove the ones that stop or crash.
Bad: DNS with a 5 s TTL
Caches ignore it: the JVM keeps lookups 30 s by default, or forever.
Good: Push changes, or a virtual IP
Watches push each change; a virtual IP hides the churn.
Said goodbye: at most 30 s. Crashed: about 110 s.
With Eureka’s defaults, renew every 30 s, evict after 90 s of silence. Planned exits must deregister; the TTL is the crash safety net.
1,800
calls fail or hang on one crashed pod
30 s TTL + 30 s client refresh = up to 60 s stale, at 30 req/s. Eject after 5 straight failures and it’s about 100.
The registry is unreachable during a network split. Should callers stop calling?
Discovery is AP
A stale list beats no list. A wrong entry costs one retry; an unreachable registry costs every call.
Whoever reads the list does the load balancing
Client-side: one hop and smarter balancing, but a library per language. Server-side: simple clients, but an extra hop and a router to scale.
Kubernetes does all three jobs for you
- Readiness decides which pods get listed
kube-proxyprograms rules on every node- Callers connect to one name and virtual IP
- A
preStopsleep keeps deploys lossless
Remember
Callers know names, not IPs. Treat the registry as a hint: keep the last good list, deregister on shutdown, retry elsewhere.