Preemptible VM Instances

This page describes preemptible virtual machine (VM) instances. To learn how to create a preemptible instance, read Creating a Preemptible Instance. To learn more about instances in general, read the Virtual Machine Instances documentation.

Contents

What is a preemptible instance?

A preemptible VM is an instance that you can create and run at a much lower price than normal instances. However, 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 your applications are fault-tolerant and can withstand possible instance preemptions, then preemptible instances can reduce your Compute Engine costs significantly. For example, 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 your batch processing tasks without placing additional workload on your existing instances, and without requiring you to pay full price for additional normal instances.

Preemptible instance limitations

Preemptible instances function like normal instances, but have the following 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.
  • Preemptible instances are finite Compute Engine resources, so they might not always be available.
  • Preemptible instances cannot live migrate 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 (and, for clarity, are excluded from the Google Compute Engine SLA).

Preemption process

Compute Engine performs the following steps to preempt an instance:

  1. Compute Engine sends a preemption notice to the instance in the form of an ACPI G2 Soft Off signal. You can use a shutdown script to handle the preemption notice and complete cleanup actions before the instance stops.
  2. If the instance does not stop after 30 seconds, Compute Engine sends an ACPI G3 Mechanical Off signal to the operating system.
  3. Compute Engine transitions the instance to a TERMINATED state.

You can simulate an instance preemption by stopping the instance.

Preempted instances still appear in your project, but you are not charged for the instance hours while it remains in a TERMINATED state. You can access and recover data from any persistent disks that are attached to the instance, but those disks still incur storage charges until you delete them. As with normal instances, persistent disks that are marked for auto-delete are deleted when you delete the preemptible instance.

If Compute Engine terminates a preemptible instance less than 10 minutes after it is created, you are not billed for the use of that virtual machine instance. This ensures that you do not pay for preemptible instances unless they have had time to complete a significant amount of work. However, the charges for premium operating systems are still calculated as normal.

Preemption selection

Generally, Compute Engine avoids preempting too many instances from a single customer and will preempt instances that were launched most recently. This might be a bit frustrating at first, but in the long run, this strategy helps minimize lost work across your cluster. Compute Engine doesn't bill for instances preempted in the first 10 minutes, so you also save on costs.

For reference, we've observed from historical data that the average preemption rate varies between 5% and 15% per seven days per project, occasionally spiking higher depending on time and zone. Keep in mind that this is an observation only: preemptible instances have no guarantees or SLAs for preemption rates or preemption distributions.

Preemptible instances in a managed instance group

You can create preemptible instances in a managed instance group. Specify the preemptible option in the instance template before you create or update the group.

Managed instance groups can create or add new preemptible instances only when additional Compute Engine resources are available. If these 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 operating systems on preemptible instances

Preemptible instances do not reduce the cost of premium operating systems and do not change the way that you are billed for the use of those operating systems. If Compute Engine terminates a preemptible instance that runs a premium operating system, you are billed for that operating system as if you terminated the instance yourself. 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 are always billed by the minute, and follow the prices listed on the Machine type pricing page.

What's next?

Send feedback about...

Compute Engine Documentation