Embed Service Discovery
Distributed Services with Go — by Travis Jeffery (51 / 84)
👈 Why Use Service Discovery? | TOC | Discover Services with Serf 👉
When you have an application that needs to talk to a service, the tool you use for service discovery needs to perform the following tasks:
- Manage a registry of services containing info such as their IPs and ports;
- Help services find other services using the registry;
- Health check service instances and remove them if they’re not well; and
- Deregister services when they go offline.
Historically, people who’ve built distributed services have depended on separate, stand-alone services for service discovery (such as Consul, ZooKeeper, and Etcd). In this architecture, users of your service run two clusters: one for your service and one for your service discovery. The benefit of using a service-discovery service is that you don’t have to build service discovery yourself. The downside to using such a service, from your users’ standpoint, is that they have to learn, launch, and operate an extra service’s cluster. So using a stand-alone service for discovery removes the burden from your shoulders and puts it on your users’. That means many users won’t use your service because the burden is too much for them, and users who do take it on won’t recommend your service to others as often or as highly.