Google has a massive infrastructure distributed throughout the globe and a dynamic mix of workloads, which implies that some of its infrastructure capacity may remain idle. Spot VMs are Compute Engine VMs that utilize this idle capacity whenever it is accessible. Spot VMs are extremely cost-effective compute instances appropriate for batch tasks and fault-tolerant workloads.
Features
● Same machine types as standard VMs
● Offered at 60-91% discount
● No performance differences compared to standard VMs (refer to Performance comparison (on-demand vs Spot) section of this article).
● Useful for stateless, fault tolerant or batch workloads
● Spot VMs have no expiration time. Only terminated when Compute Engine needs resources for standard VMs
Limitations
● Spot VMs are idle capacity, therefore they might not always be available.
● Not covered by any other SLA and are not included in the Compute Engine Service Level Agreement (SLA).
● Cannot be used with Google Cloud Free Tier credits for Spot VMs.
Customers who run workloads at a drastically reduced rate can choose to do so profitably thanks to GCP Spot pricing. These prices change over time, up to once every 30 days. Spot VMs provide at least a 60% discount and up to a 91% discount on the price of standard VMs with the same machine types.
The actions taken by Compute Engine to preempt Spot VMs are as follows:
1. The VM receives a preemption notification from Compute Engine in the form of an ACPI G2 Soft Off signal. Before the VM shuts down, you can handle the preemption notice and perform cleanup tasks using a shutdown script.
2. After 30 seconds, if the VM is still running, Compute Engine notifies the operating system with an ACPI G3 Mechanical Off signal.
3. Depending on the termination action you set for each VM, the final state of Spot VMs varies: ○ The VM is stopped by the Compute Engine and moves into the TERMINATED state if the termination action is set to STOP or not specified.
○ The virtual machine is deleted by Compute Engine if the termination action is set to DELETE.
gcloud beta compute instance-templates create spot-vm-instance-template
--project=project_id --machine-type=e2-standard --provisioning-model=SPOT
gcloud compute instance-groups managed create spot-vms-mig
--base-instance-name=spot-vms-mig --size=2 --template=spot-vm-instance-template --region=us-central1
gcloud beta container clusters create "spot-cluster" --project project_id --zone "us-central1-c" --machine-type "n1-standard-1"
gcloud beta container node-pools create "spot-vm-pool" --project project_id --cluster
apiVersion: v1
kind: Pod
metadata:
name: "spot-vm-pod"
spec:
containers:
- name: "nginx"
image: "nginx:latest"
nodeSelector:
cloud.google.com/gke-spot: "true"
apiVersion: v1
kind: Pod
metadata:
name: "standard-vm-pod"
spec:
containers:
- name: "nginx"
image: "nginx:latest"
nodeSelector:
cloud.google.com/gke-nodepool: standard-vm-pool
With over a decade of premier partner status, 66degrees aligns with Google Cloud to ensure a seamless experience for our clients — from our shared vision to the way we organize our teams.
600 West Van Buren Street, Suite 603 Chicago, IL, 60607
1125 17th St Suite 2550, Denver, CO 80202
Zona Franca Metropolitana, Edificio Administrativo Heredia Ulloa, 40104, Costa Rica
#447 Arjun Arcade
6th Main Jayachamrajendra Road, Vijayanagar 1st Stage, Mysuru, Karnataka 570017, India