Scott Decker
Scott Decker

Reputation: 4307

Azure Load Balancing of Cloud Service not working

I have a web app deployed to a Cloud Service on two instances, size A1v2 standard. My understanding is that once I have multiple instances deployed that service the same public endpoint, load balancing should automatically be handled by Azure (since it's a Cloud Service).

I RDP into each instance. Here is the first instance: enter image description here

As you can see, it's using 100% of CPU.

Here is the second instance: enter image description here

Just sitting there! Not doing a bloody thing!

The worst part is that this also kills autoscaling. The average CPU usage is 50% so Azure doesn't provision any more instances. Possibly a good thing since they'd just be sitting there doing nothing anyway (facepalm).

Upvotes: 0

Views: 990

Answers (2)

Jeffrey Holmes
Jeffrey Holmes

Reputation: 367

I am researching and going through a similar issue to you. Cloud Services that scale, don't seem to be evenly distributing the requests immediately. I do find that when waiting a while, i can see in application insights the requests are actually being distributed and the CPU starts to be split and change on both instances.

I just got off a Phone Support call from MS regarding this, and wanted to understand by default the Scaled Load Balancer how it works - and they helped me understand the Hash used to distribute requests is based off a 5 Tuple Hash rule which checks the following 5 tuples.

Quote from their email reply

Azure LB will follow the 5 tuples rule to distribute different requests. 
If the 5 tuples of the requests are all the same, 
Load Balancer will distribute the requests to the same role for further work.

The 5 tuples are: 
•   Source IP
•   Source Port
•   Destination IP
•   Destination Port
•   Protocol Type

More Info Here: https://learn.microsoft.com/en-us/azure/load-balancer/distribution-mode-concepts

Upvotes: 0

Jason Ye
Jason Ye

Reputation: 13974

In Azure, the cloud service can work as a load balancer, the VMs should in the same Availability set, and should set load balancer rules at the endpoint. Load balancing endpoints have a one-to-many relationship between the public IP address and the local ports assigned to the services on the virtual machines in the cloud service.

One VM’s CPU usage is close to 100%, and another is 3%. Because of the Azure Load Balancer one time will send all the new requests to one VM, and after the LB probe the health of another (in my case is 15s), the LB will send new connections to another, so one VM’s CPU usage will higher than another.
Here is my LB rules: enter image description here About the auto scaling, we should check the configuration of the SCALE.
1. we should check the Instance range, if you just create 2 instances, even if the average CPU usage higher than your target, the auto scaling will not scale to 3 instances.
2. We should check the Target CPU settings. This range represents average CPU usage for the entire role. Windows Azure will add or remove virtual machines to keep you in this range. And the average CPU usage (5mins) higher\lower than the target, then the auto scale will add\remove the VM.
Here are my auto scale settings: enter image description here

Also we can find the Autoscale operation logs here: enter image description here

Upvotes: 1

Related Questions