Inefficient load balancing from NATed network

Frederic Marchal 0 Reputation points
2024-08-07T08:41:37.8633333+00:00

I have a load balancer with 4 backend VM and one public IP address. Load balancing rule has no session persistence. According to the documentation, load balancing is computed with a 5-tuple hash.

This week-end, we had 200 devices connecting to the frontend IP from one single NATed network. That is, 4 out of the 5 parameters of the 5-tuple hash were identical for every device. The only variable was the source port assigned by the router on site. According to the doc:

By default, Azure Load Balancer leverages a 5-tuple hashing algorithm to distribute traffic to healthy backend instances. If the source IP address and ports are not randomly generated or have sufficient entropy, the resulting load distribution can also be uneven.

I believe we faced just that uneven distribution as the load was mainly directed to one server.

How can I "even" the distribution in that case?

Azure Load Balancer
Azure Load Balancer
An Azure service that delivers high availability and network performance to applications.
432 questions
{count} votes

1 answer

Sort by: Most helpful
  1. KapilAnanth-MSFT 44,311 Reputation points Microsoft Employee
    2024-08-19T09:39:27.0266667+00:00

    @Frederic Marchal ,

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    As mentioned by Vlad Costa, you can consider increasing randomness in Source Ports.

    However, note that Session persistence(both methods) will not help you.

    Or you can consider Azure Application gateway

    • If the backend pool contains multiple servers, the application gateway uses a round-robin algorithm to route the requests between healthy servers. This load balances the requests on the servers.
    • See : How an application gateway works

    Kindly let us know if this helps or you need further assistance on this issue.

    Thanks,

    Kapil


    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.