|
| 1 | +--- |
| 2 | +title: Use multiple Virtual Machine sizes with Instance Mix |
| 3 | +description: Use multiple Virtual Machine sizes in a scale set using Instance Mix. Optimize deployments using allocation strategies. |
| 4 | +author: brittanyrowe |
| 5 | +ms.author: brittanyrowe |
| 6 | +ms.topic: conceptual |
| 7 | +ms.service: azure-virtual-machine-scale-sets |
| 8 | +ms.date: 06/26/2024 |
| 9 | +ms.reviewer: jushiman |
| 10 | +--- |
| 11 | + |
| 12 | +# Use multiple Virtual Machine sizes with Instance Mix (Preview) |
| 13 | +> [!IMPORTANT] |
| 14 | +> Instance Mix for Virtual Machine Scale Sets with Flexible Orchestration Mode is currently in preview. Previews are made available to you on the condition that you agree to the [supplemental terms of use](https://azure.microsoft.com/support/legal/preview-supplemental-terms/). Some aspects of this feature may change prior to general availability (GA). |
| 15 | +
|
| 16 | +Instance Mix enables you to specify multiple different Virtual Machine (VM) sizes in your Virtual Machine Scale Set with Flexible Orchestration Mode, and an allocation strategy to further optimize your deployments. |
| 17 | + |
| 18 | +Instance Mix is best suited for workloads that are flexible in compute requirements and can be run on various different sized VMs. Using Instance Mix you can: |
| 19 | +- Deploy a heterogeneous mix of VM sizes in a single scale set. You can view max scale set instance counts in the [documentation](./virtual-machine-scale-sets-orchestration-modes.md#what-has-changed-with-flexible-orchestration-mode). |
| 20 | +- Optimize your deployments for cost or capacity through allocation strategies. |
| 21 | +- Continue to make use of scale set features, like [Spot Priority Mix](./spot-priority-mix.md), [Autoscale](./virtual-machine-scale-sets-autoscale-overview.md), or [Upgrade Policies](./virtual-machine-scale-sets-set-upgrade-policy.md). |
| 22 | +- Spread a heterogeneous mix of VMs across Availability Zones and Fault Domains for high availability and reliability. |
| 23 | + |
| 24 | +## Enroll in the Preview |
| 25 | +Register for the `FlexVMScaleSetSkuProfileEnabled` feature flag using the [az feature register](/cli/azure/feature#az-feature-register) command: |
| 26 | + |
| 27 | +```azurecli-interactive |
| 28 | +az feature register --namespace "Microsoft.Compute" --name "FlexVMScaleSetSkuProfileEnabled" |
| 29 | +``` |
| 30 | + |
| 31 | +It takes a few moments for the feature to register. Verify the registration status by using the [az feature show](/cli/azure/feature#az-feature-register) command: |
| 32 | + |
| 33 | +```azurecli-interactive |
| 34 | +az feature show --namespace "Microsoft.Compute" --name "FlexVMScaleSetSkuProfileEnabled" |
| 35 | +``` |
| 36 | + |
| 37 | +## Changes to existing scale set properties |
| 38 | +### sku.tier |
| 39 | +The `sku.tier` property is currently an optional scale set property and should be set to `null` for Instance Mix scenarios. |
| 40 | + |
| 41 | +### sku.capacity |
| 42 | +The `sku.capacity` property continues to represent the overall size of the scale set in terms of the total number of VMs. |
| 43 | + |
| 44 | +### scaleInPolicy |
| 45 | +The optional scale-in property isn't needed for scale set deployments using Instance Mix. During scaling in events, the scale set utilizes the allocation strategy to inform the decision on which VMs should be scaled in. For example, when you use `LowestPrice`, the scale set scales in by removing the more expensive VMs first. |
| 46 | + |
| 47 | +## New scale set properties |
| 48 | +### skuProfile |
| 49 | +The `skuProfile` property represents the umbrella property for all properties related to Instance Mix, including VM sizes and allocation strategy. |
| 50 | + |
| 51 | +### vmSizes |
| 52 | +The `vmSizes` property is where you specify the specific VM sizes that you're using as part of your scale set deployment with Instance Mix. |
| 53 | + |
| 54 | +### allocationStrategy |
| 55 | +Instance Mix introduces the ability to set allocation strategies for your scale set. The `allocationStrategy` property is where you specify which allocation strategy you'd like to use for your Instance Flexible scale set deployments. There are two options for allocation strategies, `lowestPrice` and `capacityOptimized`. Allocation strategies apply to both Spot and Standard VMs. |
| 56 | + |
| 57 | +#### lowestPrice (default) |
| 58 | +This allocation strategy is focused on workloads where cost and cost-optimization are most important. When evaluating what VM split to use, Azure looks at the lowest priced VMs of the VM sizes specified. Azure also considers capacity as part of this allocation strategy. When using `lowestPrice` allocation strategy, the scale set deploys as many of the lowest priced VMs as it can, depending on available capacity, before moving on to the next lowest priced VM size specified. |
| 59 | + |
| 60 | +#### capacityOptimized |
| 61 | +This allocation strategy is focused on workloads where attaining capacity is the primary concern. When evaluating what VM size split to deploy in the scale set, Azure looks only at the underlying capacity available. It doesn't take price into account when determining what VMs to deploy. Using `capacityOptimized` can result in the scale set deploying the most expensive, but most readily available VMs. |
| 62 | + |
| 63 | +## Cost |
| 64 | +Following the scale set cost model, usage of Instance Mix is free. You continue to only pay for the underlying resources, like the VM, disk, and networking. |
| 65 | + |
| 66 | +## Limitations |
| 67 | +- Instance Mix is currently available in the following regions: West US, West US2, East US, and East US2. |
| 68 | +- Instance Mix is only available for scale sets using Flexible Orchestration Mode. |
| 69 | +- Instance Mix is currently only available through ARM template. |
| 70 | +- You must have quota for the VM sizes you're requesting with Instance Mix. |
| 71 | +- You can specify **up to** five VM sizes with Instance Mix at this time. |
| 72 | +- Existing scale sets can't be updated to use Instance Mix. |
| 73 | +- VM sizes can't be changed once the scale set is deployed. |
| 74 | +- For REST API deployments, you must have an existing virtual network inside of the resource group that you're deploying your scale set with Instance Mix in. |
| 75 | + |
| 76 | +## Deploy a scale set using Instance Mix |
| 77 | +The following example can be used to deploy a scale set using Instance Mix: |
| 78 | + |
| 79 | +### [REST API](#tab/arm-1) |
| 80 | +To deploy an Instance Flexible scale set through REST API, use a `PUT` call to and include the following sections in your request body: |
| 81 | +```json |
| 82 | +PUT https://management.azure.com/subscriptions/{YourSubscriptionId}/resourceGroups/{YourResourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{youScaleSetName}?api-version=2023-09-01 |
| 83 | +``` |
| 84 | + |
| 85 | +In the request body, ensure `sku.name` is set to Mix: |
| 86 | +```json |
| 87 | + "sku": { |
| 88 | + "name": "Mix", |
| 89 | + "capacity": {TotalNumberVms} |
| 90 | + }, |
| 91 | +``` |
| 92 | +Ensure you reference your existing subnet: |
| 93 | +```json |
| 94 | +"subnet": { |
| 95 | + "id": "/subscriptions/{YourSubscriptionId}/resourceGroups/{YourResourceGroupName}/providers/Microsoft.Network/virtualNetworks/{YourVnetName}/subnets/default" |
| 96 | +}, |
| 97 | +``` |
| 98 | +Lastly, be sure to specify the `skuProfile` with **up to five** VM sizes. This sample uses three: |
| 99 | +```json |
| 100 | + "skuProfile": { |
| 101 | + "vmSizes": [ |
| 102 | + { |
| 103 | + "name": "Standard_D8s_v5" |
| 104 | + }, |
| 105 | + { |
| 106 | + "name": "Standard_E16s_v5" |
| 107 | + }, |
| 108 | + { |
| 109 | + "name": "Standard_D2s_v5" |
| 110 | + } |
| 111 | + ], |
| 112 | + "allocationStrategy": "lowestPrice" |
| 113 | + }, |
| 114 | +``` |
| 115 | + |
| 116 | +--- |
| 117 | + |
| 118 | +## Troubleshooting |
| 119 | +| Error Code | Error Message | Troubleshooting options | |
| 120 | +|--------------------------------------------|-------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 121 | +| SkuProfileAllocationStrategyInvalid | Sku Profile’s Allocation Strategy is invalid. | Ensure that you're using either `CapacityOptimized` or `LowestPrice` as the `allocationStrategy` | |
| 122 | +| SkuProfileVMSizesCannotBeNullOrEmpty | Sku Profile VM Sizes cannot be null or empty. Please provide a valid list of VM Sizes and retry. | Provide at least one VM size in the `skuProfile`. | |
| 123 | +| SkuProfileHasTooManyVMSizesInRequest | Too many VM Sizes were specified in the request. Please provide no more than 5 VM Sizes. | At this time, you can specify up to five VM sizes with Instance Mix. | |
| 124 | +| SkuProfileVMSizesCannotHaveDuplicates | Sku Profile contains duplicate VM Size: {duplicateVmSize}. Please remove any duplicates and retry. | Check the VM SKUs listed in the `skuProfile` and remove the duplicate VM size. | |
| 125 | +| SkuProfileUpdateNotAllowed | Virtual Machine Scale Sets with Sku Profile property cannot be updated. | At this time, you can't update the `skuProfile` of a scale set using Instance Mix. | |
| 126 | +| SkuProfileScenarioNotSupported | {propertyName} is not supported on Virtual Machine Scale Sets with Sku Profile | Instance Mix doesn’t support certain scenarios today, like Azure Dedicated Host (`properties.hostGroup`), Capacity Reservations (`properties.virtualMachineProfile.capacityReservation`), and StandbyPools (`properties.standbyPoolProfile`). Adjust the template to ensure you’re not using unsupported properties. | |
| 127 | +| SkuNameMustBeMixIfSkuProfileIsSpecified | Sku name is {skuNameValue}. Virtual Machine Scale Sets with Sku Profile must have the Sku name property set to "Mix" | Ensure that the `sku.name property` is set to `"Mix"`. | |
| 128 | +| SkuTierMustNotBeSetIfSkuProfileIsSpecified | Sku tier is {skuTierValue}. Virtual Machine Scale Sets with Sku Profile must not have the Sku tier property set. | `sku.tier` is an optional property for scale sets. With Instance Mix, `sku.tier` must be set to `null` or not specified. | |
| 129 | +| InvalidParameter | The value of parameter skuProfile is invalid. | Your subscription isn't registered for the Instance Mix feature. Follow the enrollment instructions to register for the Preview. | |
| 130 | +| FleetRPInternalError | An unexpected error occurred while computing the desired sku split. | Instance Mix isn't supported in this region yet. Deploy only in supported regions. | |
| 131 | + |
| 132 | +## FAQs |
| 133 | +### Can I use Spot and Standard VMs with Instance Mix? |
| 134 | +Yes, you can use both Spot and Standard VMs in your scale set deployments using Instance Mix. To do so, use [Spot Priority Mix](./spot-priority-mix.md) to define a percentage split of Spot and Standard VMs. |
| 135 | + |
| 136 | +### My region doesn't support Instance Mix today. Will it support Instance Mix in the future? |
| 137 | +Instance Mix is rolling out to all Azure regions during Public Preview. Instance Mix is currently available in the following regions: West US, West US2, East US, and East US2. |
0 commit comments