Configuring autoscaling for Intelligent Voice on Microsoft Azure. The steps apply for both Ubuntu and Redhat.
- Pre-requisites
- Step 1. Create an Application Insight resource
- Step 2. Install GearmanStats on the App Node VM
- Step 3. Create images of the Proc Node VMs
- Step 4. Create a virtual machine scale set (for each Proc Node)
- Step 5. Set the Autoscale Rules (for each VM Scale Set)
- Step 6. Turn on system-assigned Identity (for App Node only)
- Step 7. Validate the setup by processing test files
Pre-requisites
The App Node VM should have the System Assigned Identity turned ON:
Step 1. Create an Application Insight resource
This is required to be able to see the custom metrics when creating the autoscaling rules.
- Sign in to the Azure portal at https://portal.azure.com
- Click on Create a resource in the upper left-hand corner of the Azure portal then click on Developer Tools and choose Application Insights
- Enter a Name and Node.js Application as an Application Type. Fill the rest of the fields then click Create
- Open the new Application Insight Resource then copy the Instrumentation Key
Step 2. Install GearmanStats on the App Node VM
GearmanStats service should be installed on the App Node VM to collect the custom metrics from Gearman and send them to Azure Monitor.
Install GearmanStats with v1.0 installer
Configure the fields as below in common-config in the gearman-stats-standalone installer:
iv_docker_registry=<IV container registry> iv_docker_registry_user=<credential to IV container registry> iv_docker_registry_passwd=<credential to IV container registry> host_name=<private ip address of app node> install_cloudwatch_logger="N" install_azure_monitor_logger="Y" instrumentation_key=<instrumentation_key copied from application insights>
Run the installation script
cd installation_scripts/ chmod +x ../**/*.sh ./install.sh
Install GearmanStats with v3.0+ installer
Coming soon
Step 3. Create images of the Proc Node VMs
This step is to create VMs for the separate Proc Node workers, following the installation guide, which will then be turned into images which you can launch multiple copies of.
The recommended approach, particularly for larger systems, is to create individual images for each worker type (ASR, VAD, Tagger, Cracker, etc)
Warning: Capturing an image from your VM will stop it and mark it as generalized which won't let you start this VM ever again! DO NOT APPLY TO APP NODE
For example, create a VM that only has the ASR Worker running on it and validate that it connects correctly the App Node VM and can process data.
Once it has been setup correctly follow these steps to create its image:
- Deprovision the VM
- Connect to your Linux VM with an SSH client
- In the SSH window, enter the following command:
sudo waagent -deprovision
Enter y to continue
After the command completes, enter exit to close the SSH client
- Create VM Image either in the portal or with Azure CLI etc - for example by following this guide: https://docs.microsoft.com/en-us/azure/virtual-machines/capture-image-portal
Step 4. Create a virtual machine scale set (for each Proc Node)
- Sign in to the Azure portal at https://portal.azure.com
- Click Create a resource in the upper left-hand corner of the Azure portal. Search for scale set, choose Virtual machine scale set, then select Create
- Enter a name for the scale set
- Select Azure Spot instance with Eviction Type = Capacity Only and Eviction Policy = Delete
- Select Instance Size according to the needs (eg. ASR = Standard_NC4as_T4 for GPU or VAD = Standard_B4ms)
- For the Operating system disk image click on Browse all images then click on My Items tab and select the Image created in the above section Create images of the Proc Node VMs
- Enter the Resource Group and Location
- Enter a Username and Password or SSH public key
- Enter the Instance count and select the Instance size needed
- Choose None for Load balancing options
- Select the Virtual Network (carefully select the current active network, otherwise need to create scale set again)
- Enable Overprovisioning in the Management tab
- Click Create
Step 5. Set the Autoscale Rules (for each VM Scale Set)
- Sign in to the Azure portal at https://portal.azure.com
- Click the Azure Monitor icon in the left pane
- Click Autoscale to view all the resources for which Autoscale is applicable, along with their current Autoscale status
- Click on the VM Scale Set created in the previous section
- Select Custom autoscale
- Enter 0 for Minimum Instance limits and Default
- Enter the Maximum Instance limits allowed
- Click on Add a rule on the Default Auto created scale condition to create a Scale Out rule
- Under Scale rule select Application Insights for Metric source
- Select the resource created in the previous section “Create an Application Insights resource” under Resource
- In Criteria select Last under Time aggregation
- Select the Metric name needed. In our example “gearmand_functions_asr_queue”
- Enter 1 under Time grain
- Select Maximum under Time grain Statistic
- Select Greater than or equal to for Operator
- Enter 1 for Threshold
- Enter 5 for Duration
- In Action select Increase Count to under Operation
- Enter 1 in Instance count
- Enter 5 for Cool down
- Click Add
- Under Scale rule select Application Insights for Metric source
- Click on Add a rule on the Default Auto created scale condition to create a Scale In rule
- Under Scale rule select Application Insights for Metric source
- Select the resource created in the previous section “Create an Application Insights resource” under Resource
- In Criteria select Last under Time aggregation
- Select the Metric name needed. In our example “gearmand_functions_asr_queue”
- Enter 1 under Time grain
- Select Maximum under Time grain Statistic
- Select Less than for Operator
- Enter 1 for Threshold
- Enter 5 for Duration
- In Action select Decrease Count by under Operation
- For Instance count enter the value of the Maximum Instance limits allowed for the condition in step 8
- Enter 5 for Cool down
- Click Add
- Add more Scale Out rules as needed. For example to increase the instance count to 2 when the asr queue in greater than or equal to 11
- Click Save
Note: double check the networking rules on the APP Node VM once all the setup has been done.
Step 6. Turn on system-assigned Identity (for App Node only)
- Sign in to the Azure portal at https://portal.azure.com
- Click on Virtual Machines and select the App node VM
- Click on Identity and Click On in Status
Step 7. Validate the setup by processing test files
Follow the validation section of the installation guide