This document provides an overview and comparison of compact placement policies and workload policies. Both policies let you configure the placement of virtual machine (VM) instances to minimize network latency. Use compact placement policies for instances that are created individually or in bulk, and use workload policies for managed instance groups (MIGs).
By default, you manage the location of your VMs only by specifying their zones. When you use future reservations or flex-start to request machine types that support Cluster Director, the VM resources that you receive are densely colocated by default. However, you might want to place specific VMs more closely together to optimize inter-VM performance in each application. To place VMs closer together, you can apply compact placement policies to VMs or high-throughput workload policies to MIGs.
Compact placement policy for VMs
When you apply compact placement policies to your VMs, Compute Engine
makes best-effort attempts to create VMs as close to each other as possible. If
your application is latency-sensitive and you want the VMs to be as close
together as possible (maximum compactness), then specify the maxDistance
field
( Preview
) when creating a compact placement
policy.
For more information, see About compact placement policies in the Compute Engine documentation.
Workload policy for MIGs
A workload policy lets you specify the type of the workload that you want to run on your infrastructure. You can also specify the physical properties of the underlying infrastructure, such as the VM placement, to best match the specified type.
You make the following configuration settings for a workload policy:
-
Workload type(
type
): for high throughput (high-throughput
) workloads, Compute Engine makes best-effort attempts to place VMs as close as possible to each other. The VM placement depends on the machine type and zone availability of the VMs. -
Additional requirement for using strict colocation or accelerator topology of VMs. You can specify one of the following:
-
Strict colocation of VMs(
maxTopologyDistance
): to achieve granular, low-latency network performance. A strict colocation means that, in addition to the best-effort to place your VMs as close to each other as possible, you can further specify the maximum distance between the VMs. If the strict colocation requirement is not met due to capacity constraints, the MIG doesn't create the VMs. -
Accelerator topology of VMs(
acceleratorTopology
): to achieve high performance for distributed workloads which run across multiple VMs that use a specialized inter-accelerator network configuration—for example, A4X VMs that use NVLink Domains for GPUs.
-
Comparison of compact placement policy and workload policy
The following table summarizes the differences between compact placement policies and workload policies:
- Standalone instances
- Instances deployed using Bulk API
Compute Engine places the instances that use the same compact placement policy closer together.
We recommend that you use a different placement policy for each workload. Reusing a placement policy across instances that run different workloads causes all those instances to be placed together. This colocation can make it difficult to create instances that are close together when you scale out a specific workload.
Compute Engine places the instances in a MIG that uses a workload policy closer together.
Reusing a workload policy across multiple MIGs that run different workloads places the instances in individual MIGs together. Reusing is ideal for large training models in which each group of instances has to be isolated from each other.
For best-effort VM colocation, set the groupPlacementPolicy.collocation
field to COLLOCATED
.
For best-effort VM colocation, set the workloadPolicy.type
field to HIGH_THROUGHPUT
.
- For strict VM placement, specify the
maxDistance
field. - For GPU families supporting partitioning,
such as A4X, specify the
gpuTopology
field.
- For strict VM placement, specify the
maxTopologyDistance
field. - For GPU families supporting partitioning,
such as A4X, specify the
acceleratorTopology
field.
Comparison of maximum distance values
A lower maximum distance value ensures closer VM placement, but it also increases the chance that some VMs won't be created.
The following table shows the machine series and number of VMs that each maximum distance value supports:
maxDistance
in a compact placement policymaxTopologyDistance
in a workload policy3
cluster
2
block
- For A4 VMs: 150
- For A3 Ultra VMs: 256