Load balancing in OnApp clouds – part 2 – autoscaling clusters
OnApp clouds include two types of load balancing to help maintain high availability for web services and content hosted in your cloud.
In my last post, I explained how to set up Load Balancing Clusters. This time, we’re going to look at how to set up Autoscaling Clusters in OnApp.
An Autoscaling Cluster is a load balancer that monitors node usage. You can set the balancer to automatically add or remove nodes from the cluster based on the usage over a period of time.
If traffic is light and the cluster doesn’t need all of the assigned nodes, it will remove a node from service. If traffic picks up and a new node is needed, the balancer will build a new node and assign it to the cluster automatically.
1. Setting up
In my previous post, I created a VM called lbdemo1 to act as one node of our previous Load Balancing Cluster. Now I have take taken a backup of that lbdemo1 node, converted it into an OnApp VM template, and named the template lbdemo1.
This template will be used to build new nodes for the autoscaling cluster, thus creating a mirror image of the VM being autoscaled.
2. Create Autoscaling Cluster
Start by navigating to the load balancer page and click on the Add New Balancer button. On the next page, fill out the requested details and select the Autoscaling radio button at the bottom of the page:
On the next page, specify the parameters to be used for the new nodes to be added to the cluster. The Min nodes parameter is the minimum number of nodes that the cluster will be reduced to; the Max nodes are the maximum number of nodes to build up to:
As you can see, I have set the “autoscale out” parameter to add a new node if the CPU usage is greater than 5% for 5 minutes – and then set the “autoscale in” parameters to remove a node if the CPU usage is less than 5% for 20 minutes.
After clicking on Save, the load balancer will be built, the minimum number of nodes specified will be built as well, and attached to the load balancer. Here’s what it looks like when it’s done:
Let’s test it
To test the autoscale function, I started a script on one of the nodes that utilized a large amount of CPU for 6 minutes, thus putting the usage over the parameter I specified for autoscaling in this example, and triggering an “autoscale up” instance.
The graph above shows the > 5% CPU usage for 5 minutes…
…and after 5 minutes of high CPU usage, a new node was built and added to the cluster. You can see that the number of nodes is now at 3:
After the autoscale up instance, I left the nodes idle for 20 minutes to test “autoscale in”.
In our example, if the CPU usage is less than 5% for 20 minutes, a node will be removed. From the graph we see that there has been 20 minutes of CPU usage below 5%…
…and as expected, a node was removed:
That’s it! If you have questions about autoscaling or load balancing in your OnApp cloud, our support team is available 24/7 to assist you in getting things up and running. You can submit a ticket through your account dashboard at https://admin.onapp.com or by sending an email directly to firstname.lastname@example.org.