Differences Between Service Discovery and Load Balancing
Last updated
Was this helpful?
Last updated
Was this helpful?
Engineers immersed in distributed computing often conflate service discovery with load balancing. Within the context of cloud computing, both concepts are associated with directing requests to a network service, but they serve distinct purposes. Service discovery is the process of automatically detecting services on a computer network. AWS offers tools like Route53 and CloudMap for service discovery. They function by utilizing DNS to automatically connect client applications with hosts running the services, thereby eliminating the need for hardcoded IP addresses, protocols, and ports. Additionally, Route53 provides health checks to ensure only healthy hosts are discovered and used. Conversely, load balancing is about distributing network traffic across a group of target servers. This process aims to optimize resource usage, maximize throughput, reduce latency, and ensure fault tolerance and redundancy. AWS Elastic Load Balancer (ELB) serves as a prime example of a load balancing tool. It accepts incoming traffic and distributes it across multiple targets, like EC2 instances. The primary difference between the two lies in their purpose. While service discovery focuses on 'finding' the services within a network, load balancing manages 'how' the requests are handled by these services once discovered. The confusion between these two concepts often arises because (1) a load balancer is often used in conjunction with service discovery. For instance, if your service's domain name is "", you will have an "Address" record in your DNS server that points the name to the IP address of your load balancer. When your client sends a request to "", it will first find the IP address of the load balancer using a DNS query, then send the request to that IP. In this scenario, the DNS query is the service discovery step, followed by the load balancing. (2) Both load balancers and service discovery can handle failover, but in different ways. Failover using service discovery relies on the client to either "re-discover" the service so that bad targets won't be used anymore, or to maintain a "bad target" list. Failover using a load balancer is transparent to the client, as the load balancer simply stops routing requests to bad targets. If your use case primarily needs to 'find' a service and your main concern is not managing heavy traffic, service discovery tools like Route53/CloudMap are your best bet. Conversely, if your primary requirement is managing and distributing large volumes of network traffic to ensure optimal performance and fault tolerance, a load balancer like AWS ALB or ELB might be a more suitable option. Alternatively, you might consider leveraging client load balancing like Netflix does. For a deeper dive into client load balancing, refer to Netflix's technical blog: