简体   繁体   中英

Disable affinity in Azure's Load Balancer for Cloud Services (Web/Worker roles)

I'm seeing a definite non-round-robin load-balancing pattern in Azure's load balancer for my cloud role. Most of the requests are going to the 1st instance of the two-instance of my Web-Api worker role setup.

How can I ensure that Azure's LB distributes requests equally?

Note the first screenshot from CloudMonix's dashboard contains CPU Utilization for 1st instance (60-65% sustained average) and 2nd screenshot contains CPU utilization for 2nd instance (2-5% sustained average) This is consistent across many different times I've looked into this.

Both of the instances are the same, only listen to many http requests and process them.

实例1 实例2

I've definitely had the same question in the past, but have noticed that over a sustained period (a few days or more) that the requests are balanced between the instances. From my personal research you cannot configure the load balancing on azure cloud services. Here is a document describing the service definition file, and I would imagine that if it was configurable, it would be in there.

However, you can configure the load balancer more explicitly using Azure Resource Manager.

There actually is a way of configuring the loadBalancerDistribution for a Cloud Service in the .csdef file. The flaw is documentation updates :-(

Please look at this article: https://azure.microsoft.com/en-us/blog/azure-load-balancer-new-distribution-mode/

The value of LoadBalancerDistribution can be sourceIP for 2-tuple affinity, sourceIPProtocol for 3-tuple affinity or none (for no affinity. ie 5-tuple)

I'll look in to getting the schema article updated to reflect this.

As for the load distribution - if you have not specifically chosen the 2- or 3-tuple algorithm, you should be running with the 5-tuple.

You can use https://resources.azure.com to look at the current configuration.

I know that CPU is a reflection of load, but the load balancer balances based on network sessions, so please ensure that the CPU load and distribution of network sessions correlate. In your situation I would be surprised if they do not - just a reminder.

Please look at this article to ensure you are not running with keep-alives: Extremely uneven cloud service load-balancing with Azure

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM