adaptive.run TECH BLOG

Cloud can be tricky sometimes. Find out what scenarios we've ran into that are worth being mentioned and explained.

Decoding Azure Spot VM Eviction Policies: A Comprehensive Guide

Level: 100
Publishing date: 06-Feb-2024
Author: Catalin Popa

Introduction

Azure Spot Virtual Machines offer substantial cost savings, with discounts of up to 90%, making them an attractive option for cloud administrators seeking efficient resource utilization. However, understanding the intricacies of eviction policies is crucial to avoiding potential pitfalls. This guide explores the nuances of Azure Spot VM eviction policies, shedding light on minimizing risks and maximizing the benefits of this cost-effective solution.


Unveiling the Azure Spot VM Eviction Policy
An eviction policy dictates the course of action when Azure's excess compute capacity is exhausted, and resources are either required elsewhere or the capacity disappears. Eviction can occur when the reduced cost of the VM exceeds the user's willingness to pay or when Azure needs to reclaim compute capacity. The dynamics of these scenarios typically undergo minimal changes over short periods or months.


Types of Evictions for Azure Spot Discounts

Evictions manifest in two types: capacity-only and price-and-capacity. Microsoft specifies that Spot VMs face eviction under the following circumstances:

             1. The current price surpasses the maximum agreed-upon price, or the capacity is needed.

             2. Azure necessitates reclaiming compute capacity.

Evictions are automated and can transpire without immediate user notification, resulting in de-allocated or deleted machines as the only available options.


Outcomes of Evicted VMs

The aftermath of an eviction depends on the VM type. For a single VM instance, the VM becomes de-allocated, and while it's usually possible to power it on when needed, regular Azure prices apply. However, there's no guarantee, and users can opt to set the system to delete evicted VMs.
Microsoft asserts that over 90% of workloads are successfully completed and shut down by users rather than being evicted. The eviction rate is published in the portal to enhance user understanding of pricing implications.

Strategies to Mitigate Eviction Risks

To significantly reduce the chance of eviction, users can adjust the price, placing it above the minimum to push other VMs to be evicted first. Setting the price to -1 ensures that the VM will not be evicted based on price under any circumstance, though eviction may still occur due to resource needs.


Implementing a price or capacity limit enables users to select a maximum price per hour, minimizing eviction risks. Utilizing the eviction policy simulator enhances understanding and aids in making informed decisions about Spot VMs.


Considerations for Minimizing Eviction Risks

When aiming to minimize eviction risks, keep the following in mind:
            1. Servers using Spot VMs should be transactional and capable of handling short-notice shutdowns.
            2. Automated build servers ideal for non-production scenarios are well-suited for Spot VMs.
            3. Avoid employing eviction policies on single production servers, as they are not designed for prolonged stability.

Multi-Server Eviction Policies

For scenarios involving multiple servers across two or more zones, eviction policies become relevant. For example, spooling up additional back-end webservers during peak loads can be followed by their removal post-peak. While there's a risk of eviction, having enough non-Spot VMs ensures a consistent base level of processing availability.

Burstable back-end web servers can benefit from eviction policies when combined with load balancers, scaling out during peak loads and scaling in afterward. The choice between achieving specific goals and cost savings depends on the use case.

It's crucial to recognize that not all VMs are burstable, with examples like B-series VMs not falling into this category. Considerations like promotional credit usage may also impact burstability.


adaptive.run

Transform your business.
Run adaptive.

Contact

Phone: +40 73 523 0005
Email: hello@adaptive.run

© Copyright  2019-2024 adaptive.run- All Rights Reserved