Scaling Helpers in GCP

Overview

This topic explains the mechanics involved in scaling cloud Helpers automatically using Managed Instance Groups, for Incredibuild for Windows. The process involves these steps:

  1. Create an Instance Template (one or more).

  2. Create a Managed Instance Group (one or more).

Because of the way autoscaling works, you will need to have a single Helper machine alive in the VPC at all times. The Managed Instance Group spins up machines based on the load on the entire group, so one machine needs to be available as a bootstrap.

Requirements

To use autoscaling you must have:

  • A GCP account, with enough permissions.

  • Access between your Coordinator and Initiators to the VPC where the helpers will run, over all relevant TCP ports (see System Requirements)

It is assumed that:

  • You have a working Incredibuild environment, either on-prem or in your VPC.

  • You have a network connection between your Coordinator and Initiators to/from your VPC.

  • You are experienced with Incredibuild technology.

  • You are well versed in managing GCP VM instances.

Step 1: Create an Instance Template

Create a Launch Template, using the following sample GCP gcloud command.

The following scripts assume that COORD contains the persistent IP address or FQDN of the Coordinator.

In the following script, replace the value of COORD with the persistent IP address or FQDN of the Coordinator, INSTANCE with the name of the machine type, and VOL with the size of the Helper disk (in GB).

Copy
VOL="50" 
INSTANCE="n2-standard-4" 
COORD="192.168.1.1" 

gcloud beta compute instance-templates create helper-template \ 
--machine-type=$INSTANCE \ 
--network-interface=network=default,network-tier=PREMIUM,stack-type=IPV4_ONLY \ 
--create-disk=auto-delete=yes,boot=yes,device-name=helper-template,image=projects/windows-cloud/global/images/windows-server-2022-dc-v20241212,mode=rw,size=$VOL,type=pd-balanced \ 
--provisioning-model=SPOT \ 
--metadata=windows-startup-script-ps1="\$COORD="$COORD";   \$ProgressPreference = 'SilentlyContinue'; invoke-webrequest https://dl.incredibuild.com/ib10-latest-silent -outfile  C:\ibsetup.exe; invoke-command -ScriptBlock { C:\ibsetup.exe /install /COMPONENTS=Agent /AGENT:AGENTROLE=helper /AGENT:HELPERTYPE=floating /Agent:InstallAddins=off /COORDINATOR=$COORD};"

Note that the Launch Template needs to connect to the same Security Groups and Subnet as the original Helper.

Step 2: Create a Managed Instance Group

The Managed Instance Group you create will control the range of vCPUS in the group (including thresholds when to spin up/down).

Create a Managed Instance Group, using the following sample GCP gcloud command.

In the following script, change the various Managed Instance Group options to match your grid acceleration requirements.

Copy
gcloud beta compute instance-groups managed create helper-instance-group \ 
--base-instance-name=helper-instance-group \ 
--template=helper-template \ 
--size=1

Set the scaling policy for the Managed Instance Group, using the following sample GCP gcloud command.

Copy
gcloud beta compute instance-groups managed set-autoscaling helper-instance-group \ 
--mode=on \ 
--min-num-replicas=1 \ 
--max-num-replicas=4 \ 
--target-cpu-utilization=0.5 \ 
--cpu-utilization-predictive-method=none \ 
--cool-down-period=60