负载均衡器如何决定如何路由请求?
How does the load balancer decide how to route requests?
标题几乎说明了一切:假设我在一个云服务的端口 80 上创建了 3 个具有负载平衡的 VM。现在有一个对云服务的请求:负载均衡器如何决定它应该将这个请求路由到这 3 个 VM 中的哪一个?是否有特定指标或负载均衡器是否随机路由?
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.
完整详情:https://azure.microsoft.com/en-us/blog/microsoft-azure-load-balancing-services/
负载均衡器可能有粘性会话,该会话将从一个 ip 路由到同一后端最长 1 小时左右
标题几乎说明了一切:假设我在一个云服务的端口 80 上创建了 3 个具有负载平衡的 VM。现在有一个对云服务的请求:负载均衡器如何决定它应该将这个请求路由到这 3 个 VM 中的哪一个?是否有特定指标或负载均衡器是否随机路由?
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.
完整详情:https://azure.microsoft.com/en-us/blog/microsoft-azure-load-balancing-services/
负载均衡器可能有粘性会话,该会话将从一个 ip 路由到同一后端最长 1 小时左右