Discovering Services

Learn about service discovery, how it is made and its different roles, and about different data distributed stores.

What is service discovery?

There are two cases where service discovery is important. First, our organization may have too many services for DNS management to be practical. Second, we may be in a highly dynamic environment. Container-based environments usually hit both of these criteria, but that’s not the only case.

Parts of service discovery

Service discovery really has two parts. First, it’s a way that instances of a service can announce themselves to begin receiving a load. This replaces statically configured load balancer pools with dynamic pools. Any kind of load balancer, whether done with hardware or software, can do this. It doesn’t require a special “cloud aware” load balancer.

The second part is lookup. A caller needs to know at least one IP address to contact for a particular service. The lookup process can appear to be a simple DNS resolution for the caller, even if some super-dynamic service-aware server is supplying the DNS service. Service discovery is itself another service. It can fail or get overloaded. It’s a good idea for clients to cache results for a short time.

Building service discovery

It’s best not to roll our own service discovery. Like connection pools and crypto libraries, there’s a world of difference between writing one that works and writing one that always works.

We can build a service discovery mechanism on top of a distributed data store such as Apache ZooKeeper or etcd. 8 ...