Munchkin
Munchkin

Reputation: 4956

How does the load balancer decide how to route requests?

The titles says nearly everything: Let's say I created 3 VM's with load balancing on port 80 in one cloud service. Now there is a request to the cloud service: How does the load balancer decide to which of these 3 VM's it should route this request? Is there a specific metric or does the load balancer routes randomly?

Upvotes: 0

Views: 1831

Answers (2)

yourstruly
yourstruly

Reputation: 1002

Load balancer may have sticky session that will route from one ip to the same backend for max 1h or something

Upvotes: 0

Alex S
Alex S

Reputation: 1594

Microsoft Azure Load Balancer is a Layer-4 type load balancer. Microsoft Azure load balancer distributes load among a set of available servers (virtual machines) by computing a hash function on the traffic received on a given input endpoint. The hash function is computed such that all the packets from the same connection (TCP or UDP) end up on the same server. The Microsoft Azure Load Balancer uses a 5 tuple (source IP, source port, destination IP, destination port, protocol type) to calculate the hash that is used to map traffic to the available servers. The hash function is chosen such that the distribution of connections to servers is fairly random. However, depending on traffic pattern, it is possible for different connections to get mapped to the same server.

Full details: https://azure.microsoft.com/en-us/blog/microsoft-azure-load-balancing-services/

Upvotes: 3

Related Questions