Among the many ways to purchase and consume Azure resources are Azure low priority VMs and Spot VMs. These virtual machines are compute instances allocated from spare capacity, offered at a highly discounted rate compared to “on demand” VMs. This means they can be a great option for cost savings – for the right workloads. And we love cost savings! Here’s what you need to know about these purchasing options.
How Interruptible VMs Work
The great part about both of these options is the price. Depending on the options selected, you can get a discount of up to 90% compared to the pay-as-you-go price. However, this is in exchange for the possibility that these VMs will be “evicted” when Azure needs the capacity, which makes them suitable for fault-tolerant applications such as batch processing, rendering, testing, some dev/test workloads, containerized applications, etc.
Azure Low Priority VMs
There are two key things to know about Low Priority VMs. The first is that they are only available through Azure Batch, Azure’s tool for running large-scale parallel and high-performance computing jobs through a pool of compute nodes (VMs). Through Azure Batch, you can run jobs and tasks across compute pools called “batch pools”. Since batch jobs consist of discrete tasks run using multiple VMs, they are a good fit to take advantage of low priority VMs.
Note that prior to February 2020, Low Priority VMs were available in Azure Scale Sets, but that option has been discontinued, with Spot VMs now available in Azure Scale Sets instead.
The second highlight is that Low Priority VM pricing is at a fixed discount of 60-80% compared to pay-as-you-go.
Azure Spot VMs
As of May 2020, Azure offers Spot instances/VMs in addition to Low Priority VMs. Like Low Priority, the Spot option allows you to purchase spare capacity at a deeply discounted price in exchange for the possibility that your VM may be evicted. You can choose whether or not to have a cap on the price you’re willing to pay for Spot VMs. Unlike Low Priority, you can use the Azure Spot option for single VMs and scale sets. VM scale sets scale up to meet demand, and when used with Spot VMs, will only allocate when capacity is available.
Your Spot VMs can be evicted when Azure needs the capacity, or when the price goes above your maximum price. You can choose to get a 30-second eviction notice and attempt to redeploy.
The other key difference is that Azure Spot pricing is variable, and based on the capacity for size or SKU in an Azure region. Prices change slowly to provide stabilization. The price will never go above pay-as-you-go rates.
When it comes to eviction, you have two policy options to choose between:
- Stop/Deallocate (default) – when evicted, the VM is deallocated, but you keep (and pay for) underlying disks. This is ideal for cases where the state is stored on disks.
- Delete – when evicted, the VM and underlying disks are deleted.
For more information about the difference between the “Deallocate” and “Stop” states, please see this article.
Azure Low Priority VMs vs. Azure Spot VMs
While similar in idea, there are a few key differences between these two purchasing options:
|Availability||Azure Batch||Single VMs, VM scale sets|
|Pricing||Fixed pricing||Variable pricing; ability to set maximum price|
|Eviction/Preemption||Preempted when Azure needs the capacity. Tasks on preempted node VMs are requeued and run again.||Evicted when Azure needs the capacity or if the price exceeds your maximum. If evicted for price and afterward the price goes below your maximum, the VM will not be automatically restarted.|
Azure Extra Capacity Options vs. AWS Spot Instances
So are low priority VMs the same as AWS Spot Instances? In some ways, yes: both options allow you to purchase excess capacity at a discounted rate.
However, there are a few key differences between these options:
- Fixed vs. variable pricing – AWS spot instances have variable pricing while Azure low priority VMs have a fixed price as listed on the website
- Integration & flexibility – AWS’s offering is better integrated into their general environment, while Azure offers limited options for low priority VMs (for example, you can’t launch a single instance) with limited integration to other Azure services.
- Visibility – AWS has broad availability of spot instances as well as a Spot Instance Advisor to help users predict availability and interruptibility. On the other hand, Azure has lower visibility into the available capacity, so it’s hard to predict if/when your workloads will run.
Should You Use Azure Low Priority VMs?
If you have fault-tolerant batch processing jobs, then yes, low priority VMs are worth a try to see if they work well for you. If you’ve used these VMs, we’re curious to hear your feedback. Have you had issues with availability? Does the lack of integrations cause any problems for you? Are you happy with the cost savings you’re getting? Let us know in the comments below.