Why would you load balance your VMs?
Consider this scenario. You have one very powerful virtual machine running your webserver. It has MySQL and Apache installed, and it runs like a dream. However, you need to shutdown MySQL to update it, or perhaps you need to run a very vital patch to the operating system. This requires you to turn off the virtual machine, causing an outage of any websites your instance happens to host for however long your maintenance task will take.
Wouldn't it be great if all that hassle and uncertainty was avoidable?
This is just one scenario, another would be splitting up resources and only turning on certain VMs when load peaks and requires others to help handle it, making your costs much more manageable and your business that much more scalable.
Avoiding downtime through Load Balancing
A simple way to help out in the above mentioned scenario would be to have three (possibly smaller depending on your load) virtual machines.
|Why do I need a separate VM for the SQL server?|
Because if you have many SQL databases, your data will be inconsistent or different across the set of VMs which will probably mean more work for you! It is much easier to separate them.
VM #1 and VM #2 have a single IP address 125.x.x.x assigned to them through the Load Balancing option within the Portal for Port 80/443.
Note: If you do not see the "Load Balancing" tab, please make sure the IP address is not attached to an instance already. You can remove it by going to Options>Disable Static NAT.
After the above is configured right. You can essentially take one server down at a time and update them. The data will continue to be 'relevant' and updated by the appropriate web server so the chance of losing data or not getting any at all is effectively halved. If both VMs are shutdown though, you are still in the same position but with this flexibility you can schedule maintenance on certain servers or even shut one down if you feel the load isn't heavy enough to warrant having both online, then fire it back online via the API if the load becomes too much. It's very exciting stuff to use and can save you a lot of hassles, time and money.
How do I do this?
Assuming you have two VMs you wish to load balance:
Go to Network>IP Addresses
Select the IP you wish to use (or acquire one).
Click on the Load Balancing tab
Add the appropriate ports you wish to Load Balance
Note: The load balancer is part firewall, so you must add the ports you wish to load balance.
Click on "Manage" on the appropriate ports and add the VMs to the port and choose the type of load balancing you wish to use (e.g. Round robin or least conn)
Please note, if you require HTTPS (port 443) services on your load balancer, please log a support ticket to have this enabled
I need some help!
If you would like some assistance with this or more information, you can give us a call on 1300 045 614 or file a ticket. We will be happy to assist.