One of the strongest benefits of cloud computing is that it gives you the ability to spread workloads over a number of servers that make up the cloud. This is great, but how do you make sure your workloads are spread out evenly and not bunched up on a few or even just one server in the cloud? In this post, I’ll be discussing load balancing the cloud as I do with Xen Cloud Control System and Xen Cloud Platform.
The goal of any load balancer, of course, is to spread the work on the cloud out to use the servers that make up the cloud as efficiently as possible. There are a couple of other considerations as well. The load balancer can’t cause the cloud to oscillate (endless shifting of load) as well as needing to deal with loads that can’t be moved.
With the XCCS load balancer, the first thing I do is make the determination that we’re only going to consider memory usage for a metric. My experience with XCP is that I’m 100% guaranteed to run out of memory long before CPU capacity. The second is that we’re going to set a 10% unbalance limit. If you try to push much closer than this, you run the very real risk of setting the cloud oscillating.
Now that we have the ground rules set, the first thing I do is identify the cloud servers with the highest and lowest amount of free memory. This starts the balancing with the two most extreme.
The next step is to identify the virtual machine with the lowest memory usage on the server with the least free memory. Moving the virtual machine with the smallest footprint is a conservative approach that once again insures that we don’t get things endlessly oscillating. A cloud that’s burdened by constantly shifting virtual machines is bad news.
Next is sanity checking to make sure the virtual machine we chose can be moved and that it can be moved to the server with the highest memory free. If this is the case, then that virtual machine is live migrated to the server with the most memory free.
The final step is for the load balancer to run the rest of its 5 passes and then further balancing waits for the next run of the load balancer. This approach makes sure that the load balancing process itself doesn’t use up all the resources and impact the working virtual machines running on the cloud.
A couple of runs of the XCCS load balancer and even the worst cloud can come out white and fluffy!
For more details on the XCCS load balancer, visit us here!