Managed instance groups (MIGs) can create virtual machine (VM) instances in bulk, achieving your target size all at once, instead of creating each instance individually. Bulk creation of instances helps to ensure that the requested resources are ready before the MIG begins to create its instances. Bulk creation is useful for batch jobs that can only start after all instances are available, for example, High Performance Computing (HPC) or distributed training.
If you need to make multiple requests in a MIG to create instances all at once, then use resize requests. For more information, see About resize requests in a MIG.
Bulk mode
In a MIG, the mode in the target size policy determines whether the MIG creates the instances independently or all at once. By default, the MIG creates its instances independently.
The following are the two modes in the target size policy:
Individual (default): In the individual mode, the MIG creates instances independently. If there is not enough capacity to create all the instances specified in the target size, then the MIG creates as many instances as possible with the available capacity and attempts to create the remaining instances as capacity becomes available.
Bulk: In the bulk mode, the MIG creates the instances all at once. If there is not enough resource capacity to create all the instances specified in the target size, then the MIG waits for the full capacity to become available. The MIG doesn't create any instance until Compute Engine has the capacity for the specified target size. By using bulk mode, you ensure that your workload receives all its required resources before the MIG begins to create the instances.
How bulk mode in a MIG works
To enable bulk mode in a MIG, you must set the target size policy mode to BULK
and specify a target size. After you specify a target size, the MIG starts the
bulk creation operation and waits for full capacity to become available.
During this waiting period, the MIG creates managed instances. These managed instances represent the actual instances that the MIG will create when the bulk creation is successfully completed. The MIG doesn't create any VM instances until Compute Engine has the capacity for all the instances specified in the target size. When the full capacity becomes available, the MIG creates your requested instances all at once.
To monitor the bulk creation operation, see View the status of bulk creation of instances.
Limitations
The following sections describe the limitations that apply when you use bulk mode in a MIG.
Instance provisioning and distribution
The following limitations apply to instance provisioning and distribution when using bulk mode:
Bulk mode supports the reservation-bound and the flex-start provisioning models. The other provisioning models are not supported.
In a regional MIG, you can only use the
ANY_SINGLE_ZONEtarget distribution shape.
Configuration changes and resizing
The following limitations apply to configuration changes and resizing when using bulk mode:
You can't change the target size policy mode in an existing MIG.
If your MIG's instance template specifies flex-start provisioning model, then you must turn off repairs in the MIG by setting the
defaultActionOnFailurefield toDO_NOTHING.When adding or removing instances from the MIG, the following conditions apply:
You can add instances by increasing the target size or by using the
createInstancesmethod only when there is no instance (targetSize = 0) in the MIG.You can remove instances by decreasing the target size to
0. To decrease to a non-zero size, the MIG must not have a bulk instance operation in progress (bulkInstanceOperation.inProgressmust befalse).
When resizing the MIG by using the
resizeAdvancedmethod, you cannot disable creation retries.
Unsupported features for MIG
Bulk mode doesn't support the following MIG features:
- Resize requests that create instances all at once
- Instance flexibility
- Autoscaling
- Canary updates
- Standby pool
Pricing
Bulk instance operation in a MIG incurs no additional charges. Instead, based on the provisioning model that you use, you incur charges as follows:
If you use MIG to create Flex-start VMs, then you incur charges as follows:
Charges begin when the MIG creates the Flex-start VMs. Google Cloud charges you for the Flex-start VMs based on Dynamic Workload Scheduler pricing.
Charges end when the MIG deletes the Flex-start VMs at the end of their run duration, or when you delete the Flex-start VMs.
If you use MIG to create VMs by consuming a reservation, then you incur charges as follows:
When the MIG creates the VMs, you don't incur charges again for the consumed reservation resources. You only incur charges for resources that the VMs use and that aren't part of the reservation, such as disks or IP addresses.
Charges end at the reservation end time. At this time, Compute Engine deletes the reservation and any VMs that consume it. For more information, see the billing for reservations.