Tuesday 30 June 2015

Configuring External Load Balancer in Microsoft Azure

In this article we will be having a look on how to create External Balancer and how Microsoft Azure built-in external load balancer distributes the traffic between the VM’s present within a Load-Balanced Set as depicted below:


To demonstrate the External Load Balancer, I have followed below mentioned steps:

1. Created two VM’s named “SQUONS-MITP-WS1” and “SQUONS-MITP-WS2” under the cloud service “squons-mitp-t2”. Both the server’s are running IIS service within them working as web server.


Note:  To make both the server highly available, I have configured both the server into Availability Set named “MITP_WS_AS”. You can also configure External Load Balancer between the VM’s which is not under any Availability Set.

2. Details of both the VM’s are as follows:


 As depicted above, it’s visible that both VM’s are sharing same public ip as they are in same cloud service whereas their internal ip addresses are different.

 3. As we will be accessing through web browser over http so we need to allow port 80 on Endpoints, as by default only RDP and PowerShell ports are allowed on Endpoints.

Note: Only one port 80 can be opened per cloud service, hence we can open port 80 for only 1 VM present within the cloud service and when we try to open port 80 for other VM then it shows an error stating endpoint rule already exist. So here in my scenario I have 2 VM's present within the cloud service and when the traffic comes for port 80 it will get mapped to the VM on whom I have created endpoint rule for port 80.

To overcome this problem, I have used External load balancer so that when the traffic comes for port 80 it will get mapped to External Load Balancer virtual ip and the load balancer will balances the traffic between 2 VM's accordingly.

4. To configure Load-Balanced Set, go to VM1 under Endpoints tab. Click Add.



5. Select “Add a Stand-Alone Endpoint” and click Next.


6. Specify the details of endpoint by providing the name of the endpoint, protocol to be used, public and private port to be opened.

Next tick on checkbox Create A Load-Balanced Set, to create new set for load balancing between VM’s.  It is used to load balance the network traffic from internet across the VM's of a cloud service.

Note: Enable Direct Server Return is used because the client incoming request can be of small bits but the server reply will be 'n' times of the incoming request in bits. So to relieve the load balancer to handle huge traffic load, the server directly respond to the client rather than going back through load balancer.

7. Now you need to define the parameters for Load-Balanced set, i.e. its name, Protocol to be used, on which port the probe will be sent to check the status of VM’s, probe interval in seconds which is sent every after 15 seconds by default to determine the status of VM’s, Number of probes which defines after how many probe the ELB can declare particular VM is down from the set (Keep alive timer).
Click Finish.



8. Now, will add the Endpoints to rest of the VM’s that will be participating in Load-Balanced Set and make them as a member of Load-Balanced Set SQUONS-WS-LB.

Go to VM2 under Endpoints tab. Click Add.



9. Here select “Add An Endpoint To An Existing Load-Balanced Set”, as I have already created one before.
Select the one which you have created from drop down box. If only one exist then it is selected by default.


10. Everything is reflected as it is from previously created endpoint apart from Name. Assign Name to the endpoint; here I mentioned the same as previous ‘HTTP’.
Moreover you can edit the Load-Balanced Set if you want to from this window and also can configure Enable Direct Server Return for VM2.
Click  Finish.



External Load Balancer is ready now; you can confirm the endpoint setting by going within the VM under Endpoints tab as depicted below:




Now you can test whether your configured External Load Balancer is functioning or not by browsing over internet as depicted below and check by refreshing the webpage its being load balanced or not:

Note: You can access your websites through public ip or through cloud service name. Moreover you can also use your own dns domain name by mapping cname to your existing domain.