-
Overview
- A preemptible VM is an instance that runs at a much lower price than normal instances
- Compute Engine might terminate (preempt) these instances if it requires access to those resources for other tasks
- Preemptible instances are excess Compute Engine capacity, so their availability varies with usage
- If apps is fault-tolerant and can withstand possible instance preemptions, preemptible instances can reduce Compute Engine costs significantly
- Batch processing jobs can run on preemptible instances
- If some of those instances terminate during processing, the job slows but does not completely stop
- Preemptible instances complete batch processing tasks without placing additional workload on existing instances and without requiring users to pay full price for additional normal instances
- Simulate an instance preemption by stopping the instance, which can be used instead of simulating a maintenance event and which avoids quota limits
-
Limitations
- Compute Engine might terminate preemptible instances at any time due to system events
- The probability that Compute Engine will terminate a preemptible instance for a system event is generally low, but might vary from day to day and from zone to zone depending on current conditions
- Compute Engine always terminates preemptible instances after they run for 24 hours. Certain actions reset the 24-hour counter
- Preemptible instances are finite Compute Engine resources, so they might not always be available
- Preemptible instances can't live migrate to a regular VM instance, or be set to automatically restart when there is a maintenance event
- Due to the above limitations, preemptible instances are not covered by any Service Level Agreement
- The Google Cloud Free Tier credits for Compute Engine do not apply to preemptible instances
-
Process
- Compute Engine sends a preemption notice to the instance in the form of an ACPI G2 Soft Off signal
- Can use a shutdown script to handle the preemption notice and complete cleanup actions before the instance stops
- If the instance does not stop after 30 seconds, Compute Engine sends an ACPI G3 Mechanical Off signal to the operating system
- Compute Engine transitions the instance to a TERMINATED state
- Simulate an instance preemption by stopping the instance
- Preempted instances still appear in project, but not charged for the instance hours while it remains in a TERMINATED state
- Users can access and recover data from any persistent disks that are attached to the instance, but disks incur storage charges until deleted
- As with normal instances, persistent disks that are marked for auto-delete are deleted when preemptible instance is deleted
- If Compute Engine terminates a preemptible instance less than one minute after it is created, users are not billed for the use of that VM instance
- This ensures that user don't pay for preemptible instances unless they have had time to complete a significant amount of work
- Charges for premium operating systems are still calculated as normal
-
Selection
- Compute Engine avoids preempting too many instances from a single customer and preempts new instances over older instances whenever possible
- This might be a bit frustrating at first, but in the long run, this strategy helps minimize lost work across clusters
- Compute Engine doesn't charge for instances if they are preempted in the first minute after they start running
- Google does not use a VM's CPU usage to determine whether it is preempted
- The average preemption rate varies between 5% and 15% per day per project, on a seven-day average, occasionally spiking higher depending on time and zone
- Preemptible instances have no guarantees or SLAs for preemption rates or preemption distributions
- Certain actions will reset the 24-hour counter for preemptible instances
- A stop and start of a compute engine instance will reset the counter because the instance transitions into a TERMINATED state
- Actions where the instance remains in RUNNING state do not reset the counter, for example, resetting an instance or running sudo reboot from within the VM
-
MIG
- Can create preemptible instances in a managed instance group
- Specify the preemptible option in the instance template before creating or updating the group
- Managed instance groups can create or add new preemptible instances only when additional Compute Engine resources are available
- If resources are limited, managed instance groups will be unable to resize or automatically scale the number of preemptible instances in the group
- Managed instance groups always attempt to maintain their target size or the size specified by the autoscaler for that group
- If Compute Engine terminates a preemptible instance in a managed instance group, the group repeatedly tries to recreate that instance using the specified instance template
- If the necessary resources become available again, the group recreates the instance and maintains the target group size
-
Premium OS
- Preemptible instances do not reduce the cost of premium operating systems and don't change billing for the use of those operating systems
- If Compute Engine terminates a preemptible instance that runs a premium operating system, the user is billed for that operating system as if they terminated the instance
- The charges for minimum usage still apply, and bills for premium operating systems are still calculated by rounding up to the nearest usage increment
- The machine types on preemptible instances that run premium operating systems are always billed by the second
-
Local SSD
- A preemptible VM instance can be started with a local SSD and Compute Engine charges preemptible prices for the local SSD usage
- Local SSDs attached to preemptible instances work like normal local SSDs and only persist for the life of the instance
- A separate quota can be requested for preemptible local SSDs, but users can also choose to use regular local SSD quota when creating preemptible local SSDs
- Compute Engine doesn't charge for local SSDs if their instances are preempted in the first minute after they start running
-
GPU
- Users can add GPUs to your preemptible VM instances at lower preemptible prices for the GPUs
- GPUs attached to preemptible instances work like normal GPUs but persist only for the life of the instance
- Preemptible instances with GPUs follow the same preemption process as all preemptible instances
- When you add a GPU to a preemptible instance, you use your regular GPU quota
- A separate quota for preemptible GPUs can be requested
- During maintenance events, preemptible instances with GPUs are preempted by default and cannot be automatically restarted
- To recreate instances after they have been preempted, use a managed instance group
- Managed instance groups recreates instances if the vCPU, memory, and GPU resources are available
- If a warning is required before an instance is preempted, or to configure an instance to automatically restart after a maintenance event, use a non-preemptible instance with a GPU
- For non-preemptible instances with GPUs, Google provides one hour advance notice before preemption
- Compute Engine does not charge for GPUs if instances are preempted in the first minute after they start running
- The maximum CPU and memory that is available for any GPU type is dependent on the zone in which the GPU resource is running
- Instances with GPUs have specific restrictions that make them behave differently than other instance types