15

I found this in the official ELB documentation

By default, a load balancer routes each request independently to the application instance with the smallest load.

but an article on Newvem says that ELB supports only Round Robin algorithm

Algorithms supported by Amazon ELB - Currently Amazon ELB only supports Round Robin (RR) and Session Sticky Algorithms.

So which one is it?

[1] http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/US_StickySessions.html

[2] http://www.newvem.com/dissecting-amazon-elastic-load-balancer-elb-18-facts-you-should-know/?lead_source=popup_ebook&oid=00DD0000000lsYR&email=muneeb%40olacabs.com

kn330
  • 827
  • 1
  • 7
  • 19
  • 1
    I'd go with the official docs over a year old, unsourced article on a random blog unless given a reason to believe otherwise. Do note, though, that "instance with the smallest load" would apply only to a particular zone - if you have one instance in zone A and two in zone B, the AWS console warns you that requests will be imbalanced. – ceejayoz Sep 09 '13 at 12:24
  • 'Do note, though, that "instance with the smallest load" would apply only to a particular zone' < Is it mentioned in the official documentation somewhere? – kn330 Sep 09 '13 at 12:42
  • I'm sure it's mentioned somewhere, but it's definitely mentioned in the AWS console when you add instances to an ELB. Here's a screenshot: http://cl.ly/image/251m3g1b0E1n – ceejayoz Sep 09 '13 at 12:46
  • Abdul, please accept the correct answer, which is crizCraig's. – tedder42 Jan 15 '15 at 22:10

2 Answers2

15

It's request count based for HTTP(S), round robin for other.

http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/TerminologyandKeyConcepts.html#request-routing

Before a client sends a request to your load balancer, it first resolves the load balancer's domain name with the Domain Name System (DNS) servers. The DNS server uses DNS round robin to determine which load balancer node in a specific Availability Zone will receive the request.

The selected load balancer node then sends the request to healthy instances within the same Availability Zone. To determine the healthy instances, the load balancer node uses either the round robin (for TCP connections) or the least outstanding request (for HTTP/HTTPS connections) routing algorithm. The least outstanding request routing algorithm favors back-end instances with the fewest connections or outstanding requests.

crizCraig
  • 266
  • 3
  • 6
  • 2
    This information is slightly out of date. The load-balancer will only send the request to healthy instances within the same availability zone if the cross-zone feature is turned off. The default setting for the cross-zone feature is enabled, thus the load-balancer will send a request to any healthy instance registered to the load-balancer using least-outstanding requests for HTTP/HTTPS, and round-robin for TCP connections. – ColtonCat Aug 18 '16 at 05:04
  • Hey @ColtonCat can you please link source for the info – Sumit Murari Jan 08 '18 at 13:18
  • Reference for info is: https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/how-elastic-load-balancing-works.html#routing-algorithm – Sumit Murari Jan 08 '18 at 13:22
3

It depends on the type of ELB used. AWS has over the time introduced Application ELB and Network ELB along with the Classic ELB.

Application Load Balancers applies listener rules and assigns the (HTTP/HTTPS) request to a target group. It selects a target from that target group using the round robin routing algorithm

Network Load Balancers node that receives the connection, selects a target from its target group using a flow hash routing algorithm

Classic Load Balancers uses round robin routing algorithm for TCP listeners and least outstanding requests routing algorithm for HTTP and HTTPS listeners

.

TLDR;

The modern ELBs use round robin routing algorithm for HTTP/HTTPS requests and flow hash routing algorithm for TCP requests.

Classic ELB used round robin routing algorithm for TCP requests and least outstanding requests routing algorithm for HTTP and HTTPS requests

Source / Further Reading : https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/how-elastic-load-balancing-works.html#routing-algorithm

Sumit Murari
  • 245
  • 1
  • 2
  • 8
Shri
  • 131
  • 3