We believe that managing even the most demanding VM-based application in Google Cloud should be easy. For instance, in a Compute Engine environment, managed instance groups (MIGs) offer autoscaling that lets you automatically change an instance group’s capacity based on current load, so you can rightsize your environment—and your costs. Autoscaling adds more virtual machines (VMs) to a MIG when there is more load, and deletes VMs when the need for VMs is lower.
But if your VMs take several minutes to initialize, you might not have sufficient capacity to respond effectively to sudden increased demand. And chances are, this happens on a regular basis, for example, every morning when your users wake up and start to use your service, or when there’s a special event like a marketing campaign or a time-bound customer offer. If only you could tell the autoscaler to spin up more VMs in anticipation of those busy periods… Well, now you can!
Introducing schedule-based autoscaling
Compute Engine’s new schedule-based autoscaling lets you improve the availability of your workloads by scheduling capacity ahead of anticipated load. If you run your workload on a managed instance group (MIG), you can schedule the required number of virtual machine (VM) instances for recurring load patterns as well as one-off events. Use scaling schedules if your workload takes a long time to initialize and you want to scale out in advance of anticipated load spikes.
You can create a schedule using the Google Cloud Console. Select an autoscaled MIG from the instance groups page and click Edit group. Under the Autoscaling policy section, click Add a new scaling schedule.
The Cloud Console allows you to check the status and manage all your existing scaling schedules.
You can also configure schedule-based autoscaling programmatically. Here’s an example command written using the gcloud CLI:
$ gcloud beta compute instance-groups managed update-autoscaling autoscaled-group \ --set-schedule=workday-capacity \ --schedule-cron="0 8 * * Mon-Fri" \ --schedule-time-zone="America/New_York" \ --schedule-duration-sec=32400 \ --schedule-min-required-replicas=10 \ --schedule-description="At least 10 VMs every Monday-Friday 8AM-5PM"
For more details, including configuration using the API, refer to the documentation.
Try schedule-based autoscaling
Schedule-based autoscaling is available in Preview across all regions. For more information on how you can manage your scaling schedules, visit the documentation.
By Pawel Wenda(Product Manager)
Source: Google Cloud Blog