Skip to content

Commit 9422281

Browse files
committed
Freshness pass
1 parent 6b4597b commit 9422281

File tree

1 file changed

+33
-36
lines changed

1 file changed

+33
-36
lines changed

articles/batch/batch-spot-vms.md

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: Run workloads on cost-effective Spot VMs
2+
title: Run Batch workloads on cost-effective Spot VMs
33
description: Learn how to provision Spot VMs to reduce the cost of Azure Batch workloads.
44
ms.topic: how-to
5-
ms.date: 04/06/2023
5+
ms.date: 04/11/2023
66
ms.custom: seodec18
77
---
88

@@ -12,31 +12,30 @@ Azure Batch offers Spot virtual machines (VMs) to reduce the cost of Batch workl
1212

1313
Spot VMs take advantage of surplus capacity in Azure. When you specify Spot VMs in your pools, Azure Batch can use this surplus, when available.
1414

15-
The tradeoff for using Spot VMs is that those VMs may not always be available to be allocated, or may be preempted at any time, depending on available capacity. For this reason, Spot VMs are most suitable for batch and asynchronous processing workloads where the job completion time is flexible and the work is distributed across many VMs.
15+
The tradeoff for using Spot VMs is that those VMs might not always be available to be allocated, or might be preempted at any time, depending on available capacity. For this reason, Spot VMs are most suitable for batch and asynchronous processing workloads where the job completion time is flexible and the work is distributed across many VMs.
1616

17-
Spot VMs are offered at a reduced price compared with dedicated VMs. For pricing details, see [Batch Pricing](https://azure.microsoft.com/pricing/details/batch/).
17+
Spot VMs are offered at a reduced price compared with dedicated VMs. To learn more about pricing, see [Batch pricing](https://azure.microsoft.com/pricing/details/batch/).
1818

1919
## Differences between Spot and low-priority VMs
2020

21-
Batch offers two types of low-cost pre-emptible VMs:
21+
Batch offers two types of low-cost VMs that could be preempted:
2222

2323
- [Spot VMs](../virtual-machines/spot-vms.md), a modern Azure-wide offering also available as single-instance VMs or Virtual Machine Scale Sets.
2424
- Low-priority VMs, a legacy offering only available through Azure Batch.
2525

26-
The type of node you get depends on your Batch account's pool allocation mode, which is settable during account creation. Batch accounts that use the **user subscription** pool allocation mode always get Spot VMs. Batch accounts that use the **Batch managed** pool allocation mode always get low-priority VMs.
26+
The type of node you get depends on your Batch account's pool allocation mode, which can be set during account creation. Batch accounts that use the **user subscription** pool allocation mode always get Spot VMs. Batch accounts that use the **Batch managed** pool allocation mode always get low-priority VMs.
2727

2828
> [!WARNING]
29-
> Support for low-priority VMs will be retired after **30 September 2025**. Please
30-
> [migrate to using Spot VMs in Batch](low-priority-vms-retirement-migration-guide.md) before then.
29+
> Low-priority VMs will be retired after **30 September 2025**. Please [migrate to Spot VMs in Batch](low-priority-vms-retirement-migration-guide.md) before then.
3130
3231
Azure Spot VMs and Batch low-priority VMs are similar but have a few differences in behavior.
3332

3433
| | Spot VMs | Low-priority VMs |
3534
|-|-|-|
3635
| **Supported Batch accounts** | User-subscription Batch accounts | Batch-managed Batch accounts |
3736
| **Supported Batch pool configurations** | Virtual Machine Configuration | Virtual Machine Configuration and Cloud Service Configuration (deprecated) |
38-
| **Available regions** | All regions supporting [Spot VMs](../virtual-machines/spot-vms.md) | All regions except Microsoft Azure China 21Vianet |
39-
| **Customer eligibility** | Not available to some subscription offer types. See more about [Spot limitations](../virtual-machines/spot-vms.md#limitations) | Available for all Batch customers |
37+
| **Available regions** | All regions that support [Spot VMs](../virtual-machines/spot-vms.md) | All regions except Microsoft Azure China 21Vianet |
38+
| **Customer eligibility** | Not available for some subscription offer types. See more about [Spot limitations](../virtual-machines/spot-vms.md#limitations). | Available for all Batch customers |
4039
| **Possible reasons for eviction** | Capacity | Capacity |
4140
| **Pricing Model** | Variable discounts relative to standard VM prices | Fixed discounts relative to standard VM prices |
4241
| **Quota model** | Subject to core quotas on your subscription | Subject to core quotas on your Batch account |
@@ -46,40 +45,40 @@ Azure Spot VMs and Batch low-priority VMs are similar but have a few differences
4645

4746
Azure Batch provides several capabilities that make it easy to consume and benefit from Spot VMs:
4847

49-
- Batch pools can contain both dedicated VMs and Spot VMs. The number of each type of VM can be specified when a pool is created, or changed at any time for an existing pool, using the explicit resize operation or using autoscale. Job and task submission can remain unchanged, regardless of the VM types in the pool. You can also configure a pool to completely use Spot VMs to run jobs as cheaply as possible, but spin up dedicated VMs if the capacity drops below a minimum threshold, to keep jobs running.
48+
- Batch pools can contain both dedicated VMs and Spot VMs. The number of each type of VM can be specified when a pool is created, or changed at any time for an existing pool, by using the explicit resize operation or by using autoscale. Job and task submission can remain unchanged, regardless of the VM types in the pool. You can also configure a pool to completely use Spot VMs to run jobs as cheaply as possible, but spin up dedicated VMs if the capacity drops below a minimum threshold, to keep jobs running.
5049
- Batch pools automatically seek the target number of Spot VMs. If VMs are preempted or unavailable, Batch attempts to replace the lost capacity and return to the target.
5150
- When tasks are interrupted, Batch detects and automatically requeues tasks to run again.
5251
- Spot VMs have a separate vCPU quota that differs from the one for dedicated VMs. The quota for Spot VMs is higher than the quota for dedicated VMs, because Spot VMs cost less. For more information, see [Batch service quotas and limits](batch-quota-limit.md#resource-quotas).
5352

5453
## Considerations and use cases
5554

56-
Many Batch workloads are a good fit for Spot VMs. Consider using them when jobs are broken into many parallel tasks, or when you have many jobs that are scaled out and distributed across many VMs.
55+
Many Batch workloads are a good fit for Spot VMs. Consider using Spot VMs when jobs are broken into many parallel tasks, or when you have many jobs that are scaled out and distributed across many VMs.
5756

58-
Some examples of batch processing use cases well suited to use Spot VMs are:
57+
Some examples of batch processing use cases that are well suited for Spot VMs are:
5958

6059
- **Development and testing**: In particular, if large-scale solutions are being developed, significant savings can be realized. All types of testing can benefit, but large-scale load testing and regression testing are great uses.
6160
- **Supplementing on-demand capacity**: Spot VMs can be used to supplement regular dedicated VMs. When available, jobs can scale and therefore complete quicker for lower cost; when not available, the baseline of dedicated VMs remains available.
62-
- **Flexible job execution time**: If there's flexibility in the time jobs have to complete, then potential drops in capacity can be tolerated; however, with the addition of Spot VMs jobs frequently run faster and for a lower cost.
61+
- **Flexible job execution time**: If there's flexibility in the time jobs have to complete, then potential drops in capacity can be tolerated. However, with the addition of Spot VMs, jobs frequently run faster and for a lower cost.
6362

6463
Batch pools can be configured to use Spot VMs in a few ways:
6564

6665
- A pool can use only Spot VMs. In this case, Batch recovers any preempted capacity when available. This configuration is the cheapest way to execute jobs.
6766
- Spot VMs can be used with a fixed baseline of dedicated VMs. The fixed number of dedicated VMs ensures there's always some capacity to keep a job progressing.
68-
- A pool can use a dynamic mix of dedicated and Spot VMs, so that the cheaper Spot VMs are solely used when available, but the full-priced dedicated VMs are scaled up when required. This configuration keeps a minimum amount of capacity available to keep the jobs progressing.
67+
- A pool can use a dynamic mix of dedicated and Spot VMs, so that the cheaper Spot VMs are solely used when available, but the full-priced dedicated VMs scale up when required. This configuration keeps a minimum amount of capacity available to keep jobs progressing.
6968

7069
Keep in mind the following practices when planning your use of Spot VMs:
7170

72-
- To maximize use of surplus capacity in Azure, suitable jobs can scale out.
73-
- Occasionally VMs may not be available or are preempted, which results in reduced capacity for jobs and may lead to task interruption and reruns.
74-
- Tasks with shorter execution times tend to work best with Spot VMs. Jobs with longer tasks may be impacted more if interrupted. If long-running tasks implement checkpointing to save progress as they execute, this impact may be reduced.
75-
- Long-running MPI jobs that utilize multiple VMs aren't well suited to use Spot VMs, because one preempted VM can lead to the whole job having to run again.
71+
- To maximize the use of surplus capacity in Azure, suitable jobs can scale out.
72+
- Occasionally, VMs might not be available or are preempted, which results in reduced capacity for jobs and could lead to task interruption and reruns.
73+
- Tasks with shorter execution times tend to work best with Spot VMs. Jobs with longer tasks might be impacted more if interrupted. If long-running tasks implement checkpointing to save progress as they execute, this impact might be reduced.
74+
- Long-running MPI jobs that utilize multiple VMs aren't well suited for Spot VMs, because one preempted VM can lead to the whole job having to run again.
7675
- Spot nodes may be marked as unusable if [network security group (NSG) rules](batch-virtual-network.md#general-virtual-network-requirements) are configured incorrectly.
7776

7877
## Create and manage pools with Spot VMs
7978

8079
A Batch pool can contain both dedicated and Spot VMs (also referred to as compute nodes). You can set the target number of compute nodes for both dedicated and Spot VMs. The target number of nodes specifies the number of VMs you want to have in the pool.
8180

82-
For example, to create a pool using Azure virtual machines (in this case Linux VMs) with a target of 5 dedicated VMs and 20 Spot VMs:
81+
For example, to create a pool using Azure virtual machines, in this case Linux VMs, with a target of 5 dedicated VMs and 20 Spot VMs:
8382

8483
```csharp
8584
ImageReference imageRef = new ImageReference(
@@ -107,44 +106,43 @@ int? numDedicated = pool1.CurrentDedicatedComputeNodes;
107106
int? numLowPri = pool1.CurrentLowPriorityComputeNodes;
108107
```
109108

110-
Pool nodes have a property to indicate if the node is a dedicated or
111-
Spot VM:
109+
Pool nodes have a property to indicate if the node is a dedicated or Spot VM:
112110

113111
```csharp
114112
bool? isNodeDedicated = poolNode.IsDedicated;
115113
```
116114

117-
VMs may occasionally be preempted. When preemption happens, tasks that were running on the preempted node VMs are requeued and run again.
115+
VMs might occasionally be preempted. When preemption happens, tasks that were running on the preempted node VMs are requeued and run again.
118116

119117
For Virtual Machine Configuration pools, Batch also performs the following behaviors:
120118

121-
- The preempted VMs have their state updated to **Preempted**.
119+
- The preempted VMs have their state updated to *Preempted*.
122120
- The VM is effectively deleted, leading to loss of any data stored locally on the VM.
123-
- A list nodes operation on the pool will still return the preempted nodes.
124-
- The pool continually attempts to reach the target number of Spot nodes available. When replacement capacity is found, the nodes keep their IDs, but are reinitialized, going through **Creating** and **Starting** states before they're available for task scheduling.
121+
- A list nodes operation on the pool still returns the preempted nodes.
122+
- The pool continually attempts to reach the target number of Spot nodes available. When replacement capacity is found, the nodes keep their IDs, but are reinitialized, going through *Creating* and *Starting* states before they're available for task scheduling.
125123
- Preemption counts are available as a metric in the Azure portal.
126124

127125
## Scale pools containing Spot VMs
128126

129-
As with pools solely consisting of dedicated VMs, it's possible to scale a pool containing Spot VMs by calling the Resize method or by using autoscale.
127+
As with pools solely consisting of dedicated VMs, it's possible to scale a pool containing Spot VMs by calling the `Resize` method or by using autoscale.
130128

131-
The pool resize operation takes a second optional parameter that updates the value of **targetLowPriorityNodes**:
129+
The pool resize operation takes a second optional parameter that updates the value of `targetLowPriorityNodes`:
132130

133131
```csharp
134132
pool.Resize(targetDedicatedComputeNodes: 0, targetLowPriorityComputeNodes: 25);
135133
```
136134

137135
The pool autoscale formula supports Spot VMs as follows:
138136

139-
- You can get or set the value of the service-defined variable **$TargetLowPriorityNodes**.
140-
- You can get the value of the service-defined variable **$CurrentLowPriorityNodes**.
141-
- You can get the value of the service-defined variable **$PreemptedNodeCount**. This variable returns the number of nodes in the preempted state and allows you to scale up or down the number of dedicated nodes, depending on the number of preempted nodes that are unavailable.
137+
- You can get or set the value of the service-defined variable `$TargetLowPriorityNodes`.
138+
- You can get the value of the service-defined variable `$CurrentLowPriorityNodes`.
139+
- You can get the value of the service-defined variable `$PreemptedNodeCount`. This variable returns the number of nodes in the preempted state and allows you to scale up or down the number of dedicated nodes, depending on the number of preempted nodes that are unavailable.
142140

143141
## Configure jobs and tasks
144142

145143
Jobs and tasks may require some extra configuration for Spot nodes:
146144

147-
- The JobManagerTask property of a job has an **AllowLowPriorityNode** property. When this property is true, the job manager task can be scheduled on either a dedicated or Spot node. If it's false, the job manager task is scheduled to a dedicated node only.
145+
- The `JobManagerTask` property of a job has an `AllowLowPriorityNode` property. When this property is true, the job manager task can be scheduled on either a dedicated or Spot node. If it's false, the job manager task is scheduled to a dedicated node only.
148146
- The `AZ_BATCH_NODE_IS_DEDICATED` [environment variable](batch-compute-node-environment-variables.md) is available to a task application so that it can determine whether it's running on a Spot or on a dedicated node.
149147

150148
## View metrics for Spot VMs
@@ -155,7 +153,7 @@ New metrics are available in the [Azure portal](https://portal.azure.com) for Sp
155153
- Low-Priority Core Count
156154
- Preempted Node Count
157155

158-
To view these metrics in the Azure portal
156+
To view these metrics in the Azure portal:
159157

160158
1. Navigate to your Batch account in the Azure portal.
161159
2. Select **Metrics** from the **Monitoring** section.
@@ -166,11 +164,10 @@ To view these metrics in the Azure portal
166164
- Spot VMs in Batch don't support setting a max price and don't support price-based evictions. They can only be evicted for capacity reasons.
167165
- Spot VMs are only available for Virtual Machine Configuration pools and not for Cloud Service Configuration pools, which are [deprecated](https://azure.microsoft.com/updates/azure-batch-cloudserviceconfiguration-pools-will-be-retired-on-29-february-2024/).
168166
- Spot VMs aren't available for some clouds, VM sizes, and subscription offer types. See more about [Spot limitations](../virtual-machines/spot-vms.md#limitations).
169-
- Currently, [Ephemeral OS disks](create-pool-ephemeral-os-disk.md) aren't supported with Spot VMs due to the service managed
170-
eviction policy of Stop-Deallocate.
167+
- Currently, [ephemeral OS disks](create-pool-ephemeral-os-disk.md) aren't supported with Spot VMs due to the service-managed eviction policy of *Stop-Deallocate*.
171168

172169
## Next steps
173170

174171
- Learn about the [Batch service workflow and primary resources](batch-service-workflow-features.md) such as pools, nodes, jobs, and tasks.
175172
- Learn about the [Batch APIs and tools](batch-apis-tools.md) available for building Batch solutions.
176-
- Start to plan the move from low-priority VMs to Spot VMs. If you use low-priority VMs with **Cloud Services Configuration** pools (which are [deprecated](https://azure.microsoft.com/updates/azure-batch-cloudserviceconfiguration-pools-will-be-retired-on-29-february-2024/)), plan to migrate to [**Virtual Machine configuration** pools](nodes-and-pools.md#configurations) instead.
173+
- Start to plan the move from low-priority VMs to Spot VMs. If you use low-priority VMs with **Cloud Services Configuration** pools (which are [deprecated](https://azure.microsoft.com/updates/azure-batch-cloudserviceconfiguration-pools-will-be-retired-on-29-february-2024)), plan to migrate to [Virtual Machine configuration pools](nodes-and-pools.md#configurations) instead.

0 commit comments

Comments
 (0)