Chapter 19: Name Resolution and Service Discovery

gRPC Name Resolution

When you create a channel with a target like "dns:///myservice:50051", gRPC resolves it to IP addresses using a pluggable resolver.

Built-in Resolvers

SchemeExampleHow It Resolves
dnsdns:///myservice:50051DNS A/AAAA records
staticstatic:///10.0.1.1:50051,10.0.1.2:50051Hardcoded list
xdsxds:///myservicexDS protocol (Envoy/Istio)

Custom Resolvers

You can implement custom resolvers for Consul, etcd, ZooKeeper, or any service registry. The resolver watches for changes and updates the channel's address list dynamically.

xDS (Envoy Discovery Service)

The most powerful option: gRPC speaks the xDS protocol natively (same as Envoy). A control plane (Istio) pushes routing config, load balancing policy, and backend lists to gRPC clients directly — no sidecar proxy needed.