20
votes

I was trying to read up on load balancing in Windows Azure, and all the information about it is extremely vague and non-specific. All I really want is a simple answer: how does Azure perform load balancing?

Many applications use sessions or in-memory data to increase performance. With Azure, I'm not sure if this is possible, because (from what I can tell), Azure doesn't have any sort of "sticky" sessions. Even if it wasn't session-based, but simply IP-based balancing, that would be enough for many applications.

So, the question of the day - how exactly does Azure perform its load balancing?

5
Much later in 2014... Just in case anyone else lands here: windowsitpro.com/azure/azure-load-balancer-stickiness-optionsDawesi

5 Answers

15
votes

Ok to give a correct answer here - Azure DOES support load balancing in front of both web and worker roles (so the answer marked as best on this thread is completely wrong), but it does not support Affinity load balancing which is what jvenema was asking for I think. The current implementation uses round robin behaviour.

7
votes

Azure handles load-balancing for table storage and SQL Azure by distributing traffic across the instances you set up.

For things like session state with a traditional asp.net app, the session data would be stored in table storage, which would then be available to all your webrole instances. This is mentioned here.

Windows Azure provides load balancing across each public endpoint, allowing you to scale your application to as many instances as you'd like. You need to ensure that your application is stateless (or stores state in a common area across instances, such as blobs or tables). The only endpoints not load-balanced are internal endpoints. So, if you're doing some type of inter-role communication, like from a web role to one of several worker role instances hosting a wcf service on an internal endpoint, you'd need to handle load balancing across those instances.

7
votes

While the load balancing used to be round robin, Microsoft have since changed the way they do the load balancing as described in this blog:

http://azure.microsoft.com/blog/2014/04/08/microsoft-azure-load-balancing-services/

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

3
votes

I realize this is an old question but we solved the Affinity problem by using Windows Web Farm Framework and creating a layer of proxy servers that support Affinity through to our web servers.

http://technet.microsoft.com/en-us/library/jj129385.aspx

This is the architecture recommended if you were self hosting and seems to apply equally to Azure. The layers look something like this...

Firewall: Azure Load Balancer (round-robin to proxy servers)

Proxy: Application Request Routing (ARR) to perform load balancing with Affinity to web servers, static and dynamic compression and SSL. Offloading SSL to the Proxy servers gives web servers additional processor time. Also, the Web Farm Framework is great for scaling as it manages each additional web server, copies application files, monitors health, switches online/offline, etc. You could have 10,000+ web servers managed by it.

Web: Normal web servers (no SSL, compression, etc. required).

Database: Normal database servers or Azure SQL.

It is recommended by Microsoft that you have at least two ARR (Proxy) servers. Some people will gawk at the additional cost in Azure. However, we discovered that Micro Instances ($15 pm) are more than suitable as Proxy servers, if 5 mbit is sufficient speed.

Another alternative is to have two ARR server configured as Small Instances ($65pm @ 100 mbit) but have one turned off and only enable it at peak periods or when the first server fails (eg. maybe schedule second ARR server to start when first is running Windows Updates and stop an hour later).

It's a nuisance to set up but once it's working, it's very slick!

NOTE: There is some confusion in WFF documentation about the terms ARR, proxy and controller. They are usually all the same thing. Remember this if you try to set it up.

1
votes

I think you might be looking for Windows Azure AppFabric and Velocity, specifically. Take a look at one of the PDC sessions for more info.