Share via


Quick Tips to Optimize Virtual Machines on Azure

Azure provides many choices for virtual machines, which are versatile and easy to use. When deploying or improving your environment, use these tips to optimize and save money.

Tip #1 Downsize Virtual Machines

Downsizing a virtual machine refers to changing its size (or SKU), either by reducing the allocated resources (such as CPU and memory) or switching to a smaller instance type. This allows you to optimize costs or adjust performance based on your requirements.

How to Resize a Virtual Machine

Azure Advisor will provide recommendations for resizing virtual machines. Recommendation criteria include CPU, Memory and Outbound Network utilization. Learn how to improve the performance of highly used VMs using Azure Advisor.

Tip #2 Right-Size Disks

Assign virtual machine disk sizes based on actual requirements rather than over-provisioning. You can always expand data drives later without downtime.

When determining the right disk size and SKU for an Azure virtual machine (VM), consider the following:

  1. For production environments, opt for the dedicated Standard SSD pricing tier or higher for your VM disks. This helps strike a balance between performance and cost.

  2. Use Premium SSD v2 disks and programmatically adjust their performance based on workload patterns. This allows you to account for varying demand without over-provisioning.

  3. For Dev/Test workloads, evaluate if Premium disks can be replaced with Standard Disks.

How to Change a Disk

To change the Disk SKU, go to the Azure Portal. Select Disks and then select the disk you want to change. Choose Size + Performance. Change the Disk SKU and then select Resize. Before you make any changes, ensure the Virtual Machine is stopped and deallocated. Learn how to convert managed disks storage between different disk types.

Tip #3 Consider Spot Virtual Machines

Azure Spot Virtual Machines offer deeply discounted access to Azure's unused compute capacity. Here's why they're valuable and when to consider them:

Cost Savings: Spot VMs can be up to 90% cheaper than regular pay-as-you-go VMs.

Workload Flexibility: Use Spot VMs for workloads that can handle interruptions, such as:

Batch Processing Jobs

Dev/Test Environments

Keep in mind, although Spot VMs are cost-effective, they come with no high availability guarantees or SLAs. Additionally, at any point in time when Azure needs the capacity back, Spot VMs can be evicted with just 30-seconds notice.

How to Create an Azure Spot Instance

Create a Virtual Machine choosing an Azure spot instance, choose your eviction type and policy and set the max price you're willing to pay per hour (optional). If you set the max price to -1, the VM won't be evicted based on price. Instead, the price for the VM will be the current price for spot or the price for a standard VM, whichever is less, based on capacity and quota availability. Learn how to build workloads on spot virtual machines.