Auto Scale Applications with VMware Cloud Director

Starting with VMware Cloud Director 10.2.2, Tenants can auto scale applications depending on the current CPU and memory utilization. Depending on predefined criteria for the CPU and memory use, VMware Cloud Director can automatically scale up or down the number of VMs in a selected scale group.

Cloud Director Scale Groups are a new top level object that tenants can use to implement automated horizontal scale-in and scale-out events on a group of workloads. You can configure auto scale groups with:

  • A source vApp template
  • A load balancer network
  • A set of rules for growing or shrinking the group based on the CPU and memory use

VMware Cloud Director automatically spins up or shuts down VMs in a scaling group based on above three settings.This blog post will help you to enable Scale Goups in Cloud Director and also we will configure Scale Groups.

Configure Auto Scale

Login to Cloud Director 10.2.2 cell with admin/root credential and eanble metric data collection and publishing by setting up the metrics collection in a Cassandra database or collect metrics without metrics data persistence. in this post we are going to configure without metrics data persistence, to collect metrics data without data persistence, run the following commands:

#/opt/vmware/vcloud-director/bin/cell-management-tool manage-config -n statsFeeder.metrics.collect.only -v true 

#/opt/vmware/vcloud-director/bin/cell-management-tool manage-config -n statsFeeder.metrics.publishing.enabled -v true

Now the second step is to create a file named “metrics.groovy” file in the /tmp folder of cloud director appliance with the following contents:

configuration {
    metric("cpu.ready.summation") {
        currentInterval=20
        historicInterval=20
        entity="VM"
        instance=""
        minReportingInterval=300
        aggregator="AVERAGE"
    }
}

Change the file permission appropriatly and import the file using below command:

$VCLOUD_HOME/bin/cell-management-tool configure-metrics --metrics-config /tmp/metrics.groovy

Lets enable auto scalling plugin by running below commands on Cloud Director Cell:

$VCLOUD_HOME/bin/cell-management-tool configure-autoscale --set enabled=true
$VCLOUD_HOME/bin/cell-management-tool configure-autoscale --set username=<username> (should having admin priveldge account)
$VCLOUD_HOME/bin/cell-management-tool configure-autoscale --encrypt --set password=<password> ( Password for the above account)

If you see in the Cloud Director provider console, under customize portal , there will be a plugin which provider can enable to tenants who needs auto scale functionality for the applications or can be made available to all tenants.

Since Auto Scale released with VMware Cloud Director 10.2.2, which allows service providers to grant tenant rights to create scale groups.Under Tenant Access Control, select Rights Bundles and then select the “vmware:scalegroup Entitlement” bundle, and click Publish.

Also ensure provider Add the necessary VMWARE:SCALEGROUP rights to the tenant roles that want to use scale groups.

Tenant Self Serive

On the Tenant portal after login, select Applications and select the Scale Groups tab and Click New Scale Group.

Select an organization VDC in which tenant want to create the scale group.

Or Tenant can also access scale groups from a selected organization virtual data center (VDC) by going in to specific organization VDC

  • Enter a name and a description of the new scale group.
  • Select the minimum and maximum number of VMs to which you want the group to scale and click Next.

Select a VM template for the VMs in the scale group and a storage policy, and click Next. Template needs to be pre-populated in catalog by tenant or can be by provider and published for tenants.

Next step is to select a network for the scale group.If Tenants oVDC is backed by NSX-T Data Center and NSX ALB (AVI) has been published as a load balancer by provider, then tenant can choose NSX ALB load Balancer edge on which load balacing has been enabled and Server pool has been setup by tenant before enabling Scale Groups.

If tenant want to manage the load balancer on your own or if there is no need for a load balancer, thenn select I have a fully set-up network, Auto Scale will automatically adds VM to this network.

VMware Cloud Director starts the initial expansion of the scale group to reach the minimum number of VMs, besically it will start creating a VM from template that tenant selected while creating scale group and it will continue to spin up to minimum number VM spacified in the scale group section.

Add an Auto Scaling Rule

  1. Click Add Rule.
  2. Enter a name for the rule.
  3. Select whether the scale group must expand or shrink when the rule takes effect.
  4. Select the number of VMs by which you want the group to expand or shrink when the rule takes effect.
  5. Enter a cooldown period in minutes after each auto scale in the group.The conditions cannot trigger another scaling until the cooldown period expires and cooldown period resets when any of the rules of the scale group takes effect.
  6. Add a condition that triggers the rule.The duration period is the time for which the condition must be valid to trigger the rule. To trigger the rule, all conditions must be met.
  7. To add another condition, click Add Condition. tenant can add multiple conditions.
  8. Click Add.

From the details view of a scale group, when you select Monitor, you can see all tasks related to this scale group. For example, you can see the time of creation of the scale group, all growing or shrinking tasks for the group, the rules that initiated the tasks, in side Virtual Machine section which VM has been created at what time and what is the IP address of the VM etc…

here is the section showing scale takes which trigered and its status.

Virtual Machine section as said provides scale group VM information anf its details.

here is the another section showing scale takes which trigered and thier status , start time and completion time.

Auto Scale Group in Cloud Director 10.2.2 brings very important functionality nativily to cloud director which does not require any external configuration like vRealize Orchestrator or vRops and does not incure addional cost to tenant or provider. go ahead uprade your cloud director , enable it and let the tenant enjoy this cool functionality.

12 thoughts on “Auto Scale Applications with VMware Cloud Director

  1. May I know what is the different with setting up the metrics collection in a Cassandra database or collect metrics without metrics data persistence?
    Why do we need this?

    Like

  2. Hi,

    thank you very much.

    I followed the guide, but unfortunately neither the rights bundle nor the plugin is visible. Any advice for me?

    Markus

    Like

      • It was DNS, now it is published, thank you.

        I used a System Administrator as user but after creating an autoscale group, I get the following error in GUI: com.vmware.ssdc.library.exceptions.InvalidUserException: Invalid user.

        Like

  3. I am trying to implement Scale Groups and I get to the point where I have created the rule, but I don’t ever get a VM deployed. Is there a rule I can implement that will always triggers a build event? Also, how do (or do) the metrics.groovy file and the CPU usage and memory usage conditions correlate?

    Like

      • I have created an autoscale user in Cloud Director (10.3.0) and given all rights to that user.

        I then ran the following commands on all my cells:

        $VCLOUD_HOME/bin/cell-management-tool manage-config -n statsFeeder.metrics.collect.only -v true
        $VCLOUD_HOME/bin/cell-management-tool manage-config -n statsFeeder.metrics.publishing.enabled -v true
        $VCLOUD_HOME/bin/cell-management-tool configure-metrics –metrics-config /tmp/metrics.groovy
        $VCLOUD_HOME/bin/cell-management-tool configure-autoscale –set enabled=true
        $VCLOUD_HOME/bin/cell-management-tool configure-autoscale –set username=autoscale
        $VCLOUD_HOME/bin/cell-management-tool configure-autoscale –encrypt –set password=NotMyRealPassword123!
        $VCLOUD_HOME/bin/cell-management-tool configure-autoscale –set enableHostnameVerification=false
        service vmware-vcd restart

        metrics.groovy contains:

        configuration {
        metric(“cpu.ready.summation”) {
        currentInterval=20
        historicInterval=20
        entity=”VM”
        instance=””
        minReportingInterval=300
        aggregator=”AVERAGE”
        }
        }

        Am I missing some other config? Scale groups create, but no VMs are ever provisioned.

        Like

  4. I have a slew of these error messages in autoscale.log:

    2022-05-03 17:06:24,287 | ERROR | pool-45-thread-1 | KeepAliveTask | Keepalive task failed |
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘vcdClientForMqtt’ defined in com.vmware.vcloud.autoscale.client.http.VcdClientConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.vmware.vcloud.api.rest.client.VcdClient]: Factory method ‘vcdClientForMqtt’ threw exception; nested exception is com.vmware.vcloud.common.crypto.CryptoException: Error decrypting data.

    Like

Leave a comment