Auto-Scaling Groups

Introduction

Auto-scaling groups are Cloudmin's way of scaling up the number of systems that provide some service in response to load. They are typically used when you have multiple virtual systems with identical configurations providing the same service, such as a website, mail server or database replicas. When CPU load or some other metric exceeds a configurable threshold on some or all systems, additional systems are created to handle the load. Conversely, a group can be reduced in size when a second set of thresholds is reached.

Creating an Auto-Scaling Group

Before creating a scaling group, you should create a virtual system that will be used as a template for the additional system that the group will create. For example, if the objective is to host a high-traffic website with variable load, this template system should have the appropriate front-end webserver and content installed and configured, so that when Cloudmin clones it the new system can accept traffic for the website immediately. This template system should be shut down, so that it can be more quickly cloned as needed.

To create a group, the steps to follow are :

  1. Create a template system as described above, with the appropriate RAM, CPU and disk limits.
  2. Go to System Monitoring -> Auto-scaling Groups on the Cloudmin left menu.
  3. In the menu at the bottom of the page, select the virtualization type for the systems in the group, and click the Add Auto-scaling Group For button.
  4. On the creation form, enter a name for your new group in the Scaling group description field.
  5. Fill in the maximum and minimum allowed systems in the group - the max should be set to prevent all your host system resources from being consumed.
  6. To limit the rate at which systems are added or removed from the group, adjust the Interval between system changes field. This only applies to background evaluations.
  7. If you want Cloudmin to start evaluating and possibly increasing the group right away, set the Auto-scaling enabled? field to Yes.
  8. Fill in the Hostname template field with a template that will be used for new system's names. The code ${num} in the template will be replaced with a unique system number, starting from zero.
  9. Select your template system from the Source system to clone menu.
  10. If desired, select allowed host systems for new virtual systems in the group in the Host systems to create on section.
  11. In the Conditions for scaling up section, enter one or more rules that will trigger the automatic addition of a virtual system to the group. For example, you might select CPU load over 0.9 for 10 minutes. More than one rule can be entered, and you can choose if any or all rules need to apply.
  12. Optionally also add rules to the Conditions for scaling down section. Make sure that these are the inverse of the up-scaling rules or lower - otherwise Cloudmin may enter a loop in which it rapidly creates and then destroys systems. For example, you could select CPU load under 0.2 for 30 minutes.
  13. In the Email notification settings section, enter the addresses you want notified when the group changes, and the conditions for sending email.
  14. Click the Create button.
  15. On the list of scaling groups, select your new group and click the Scale Up Groups button to add a first system and test that creation is working. All groups should have at least one member system for their rules to operate on.

Managing Groups

Once a group has been created, you can edit its settings by clicking on the hostname template on the Auto-Scaling Groups page. You can also select one or more groups and force immediate evaluation of their rules with the Update Systems In Groups button, or add or remove a system with the Scale Up and Scale Down buttons respectively.

To see the status of systems within a group, click on it and open the Current status section. This will show for each member system whether it is exceeding the scale up or down conditions. If the conditions are being met currently but have not been active for long enough to trigger a scaling rule, the period for which they have been active will be displayed.

Groups can also be increased or decreased via the Cloudmin API with the increase-scalegroup and decrease-scalegroup API commands. Both take a host parameter which must contain the group's hostname template. Scaling via the API can be used instead of automatic scaling based on rules, driven by code in your own application that detects when additional systems are needed.

Scaling Groups on EC2

EC2 is an excellent service for use with auto-scaling groups, as it has enormous capacity and only charges for use by the hour. Cloudmin supports the use of auto-scaling on EC2 as well, but with some minor differences :

  • Systems added to the group are created from an AMI, rather than by cloning a source system. An AMI can be created from an existing EC2 instance using the System Operations -> Create EC2 Image page in Cloudmin.
  • When creating a group, you must select an EC2 account, AMI and SSH key for new systems, just as you would when creating a new EC2 instance.
  • The hostname generated from the template in the scaling group will be set as the Unix hostname for new EC2 instances.

Scaling Groups and DNS Roundrobins

Auto-scaling groups are most useful when combined with DNS roundrobins, which automatically update a DNS record to point to multiple systems based on their status. For instructions on creating one, see the Roundrobin DNS Records page. During creation, you can use the Systems in scaling groups option to choose one or more groups' systems' IP addresses to include in the DNS record.

Each time a system is added to or deleted from an auto-scaling group, any associated DNS records will be immediately updated.