Getty Images
What you need to know about Microsoft Azure Spot VMs
The cost of spot prices can be a risk-and-reward kind of strategy. Better understand the risks that come with Azure Spot VMs so your enterprise can reap the rewards.
Cost is a major consideration when choosing a VM. Azure offers various options to save money, such as Azure Hybrid Benefit, Azure Reserved Virtual Machine Instances and Azure Spot Virtual Machines. When it comes to Spot VMs, there are major rewards, but it also comes with major risks.
Enterprises have the opportunity for massive cost savings when they purchase excess compute capacity. However, cloud providers can shut them down with little notice. Learn more about suitable workloads, benefits, limitations and best practices.
What is an Azure Spot VM?
A Spot VM is a type of cloud server instance that is available at a major discount compared to a similarly configured server purchased without an offset. According to Azure, customers can save up to 90% by choosing Spot VMs. In exchange for this discount, Azure customers must accept a significant caveat: Azure can evict Spot VMs with virtually no notice. Eviction means that the VMs are no longer available, and any workloads hosted on them are disrupted. Typically, users receive only 30 seconds of advance notice that an Azure Spot VM will be evicted.
Azure and most other major cloud providers offer spot VMs because their platforms may have unused compute capacity during times of low demand. If there aren't enough users requesting other types of VMs to use up all available server capacity, the cloud provider is left with idle servers.
Selling unused compute resources to customers as spot VMs enables the cloud provider to generate some revenue, which is better from the provider's perspective than generating no revenue at all. When demand for compute increases, the cloud provider wants to reassign spot VMs to serve as other types of VMs that generate more revenue, which is why spot VMs are subject to eviction.
How much can I save with Azure Spot VMs?
Although Azure Spot VMs can save up to 90%, actual savings vary depending on a variety of factors, including the following:
- VM configuration. Azure sets different spot pricing for each VM configuration that it offers. Some VMs may be discounted much more steeply than others.
- Cloud region. Spot pricing varies between cloud regions. You may pay less for a Spot VM hosted in one region than you'd pay for the same type of Spot VM in a different region.
- Compute capacity. The more spare capacity Azure has for a given type of VM, the steeper the spot discount it offers. As a result, pricing can regularly fluctuate.
Most Spot VMs are discounted between 75% and 90%. In some cases, savings may be closer to a mere 30% or 40%. At those rates, you might be better off using a Reserved Instance type, which could provide a similar discount without the risk of server eviction.
Spot pricing can change once you've deployed a serve. Just because a major discount is available when you choose the spot instance doesn't mean you'll enjoy the level of discount for the duration of the VM's existence.
When should I use Spot VMs?
Enterprises should take advantage of spot pricing for workloads that they can stop and restart without losing data. For example, if you're training an AI model and design a training process that can be paused in the event of VM shutdown and resumed at a later time, a Spot VM could work well.
Workloads that you're using for experimental or testing purposes may also be appropriate for Spot VMs, especially if you can tolerate disruptions. For example, if you're performing load testing for an application that you haven't deployed to production, a Spot VM could provide a low-cost environment for running tests. In the event the VM is unexpectedly evicted, it typically is not a big deal to resume tests later on a different VM.
On the other hand, workloads that must be continuously available, such as a web application or monitoring software, shouldn't run on Spot VMs. The risk of unexpected downtime due to VM eviction is too great.
Best practices for using Azure Spot VMs
In addition to making strategic decisions about which workloads to deploy on Azure Spot VMs, the following practices can help maximize rewards and minimize risks of this type of Azure VM options:
- Research historical pricing and eviction rates. In the Azure portal, check historical prices for Spot instances. You can also view how often evictions have occurred in the past. While historical data is no guarantee of future trends, it can help select Spot VM types that have a history of delivering more reliable discounts and/or availability than others.
- Select the right eviction policy. When setting up a Spot VM in Azure, you can choose to have it either "deallocated" or "deleted" in the event of eviction. Deallocation means the VM stops running but can be restarted later. Deletion means it goes away permanently. In general, deallocation is preferable, but the tradeoff is that you keep paying for any storage resources associated with a deallocated VM even after the VM stops running. If you want to minimize costs, choose a deletion eviction policy.
- Use Spot Priority Mix. Spot Priority Mix is an Azure feature that lets you create a pool of both standard VMs and Spot VMs. It automatically moves workloads to Spot VMs when they are available, while falling back to standard VMs if not. Spot Priority Mix may not work well if you have just a few workloads to run across one or two VMs. But, if you need dozens or hundreds of VMs, it's a useful way to create a mix of VM types that enable you to save money without the risk of relying on Spot VMs exclusively.
Chris Tozzi, senior editor of content and a DevOps analyst at Fixate IO, has worked as a journalist and Linux systems administrator with particular interest in open source Agile infrastructure and networking.