Why Use Service Discovery?

Distributed Services with Go — by Travis Jeffery (50 / 84)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Chapter 7 Server-to-Server Service Discovery | TOC | Embed Service Discovery 👉

Service discovery is the process of figuring out how to connect to a service. A service discovery solution must keep an up-to-date list (also known as a registry) of services, their locations, and their health. Downstream services then query this registry to discover the location of upstream services and connect to them — for example, a web service discovering and connecting to its database. This way, even if the upstream services change (scale up or down, or get replaced), downstream services can still connect to them.

In the pre-cloud days, you could set up “service discovery” with manually managed and configured static addresses, which was workable since applications ran on static hardware. Today, service discovery plays a big part in modern cloud applications where nodes change frequently.

Instead of using service discovery, some developers put load balancers in front of their services so that the load balancers provide static IPs. But for server-to-server communication, where you control the servers and you don’t need a load balancer to act as a trust boundary[41] between clients and servers, use service discovery instead. Load balancers add cost, increase latency, introduce single points of failure, and need updates as services scale up and down. If you manage tens or hundreds of microservices, then not…

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.