Getty Images/iStockphoto
In today’s world, Microsoft administrators need to balance cost management with performance optimization for their workloads. Achieving this equilibrium can often be difficult.
At times, utilizing a VM in Azure is essential to fulfill a business requirement. A cloud-based virtualized workload can be quickly deployed and scaled, making it a favored choice among many organizations. As with most cloud services that operate on a consumption basis, it is crucial to monitor and minimize expenses. There are numerous strategies to enhance the efficiency of Azure VMs, but the key takeaway is that small and steady adjustments yield the best results.
It may seem straightforward, yet the most economical VM resources are those that remain unused. Deallocating Azure VMs when they are not in use can result in substantial savings.
For instance, automating the process of deallocating development servers at the end of the day, particularly on a Friday before the weekend begins, can save approximately 64 hours of resources weekly. This deallocation can lead to significant savings if you are utilizing one of the more expensive VM SKUs.
Thankfully, this task can be automated. Microsoft provides a video that demonstrates this method. You can also automate this process using Azure Functions. This is why it is essential to correctly tag your VMs. For example, a script can be created to manage any VMs that are tagged with Development. These tags allow you to automatically start or deallocate VMs based on a predefined schedule.
It is crucial to grasp Azure terminology because deallocating a VM differs from merely powering it off. When a VM is placed into a deallocated state, it releases the associated compute resources and ceases all charges. Microsoft continues to charge for the reserved compute resources of a powered-off VM, even when it is not actively running.
I have encountered many individuals who overlook the Azure Advisor. This tool, among other functions, offers suggestions for reducing costs associated with your Azure resources. It is an incredibly beneficial resource when utilized properly. Over time, Azure Advisor assesses VMs based on specific criteria and provides recommendations. While you are not obliged to follow its suggestions, you should review its recommendations and evaluate their validity.
Choosing the right VM SKU is crucial, as specific SKUs are optimized for particular workloads. For instance, while a D-series VM may be adequate for general tasks, other SKUs like the M-series are specifically tailored for handling database or data analytics needs.
When utilized correctly, Azure Spot VMs—often referred to as spot instances—are excellent options for non-production environments. These instances provide a way for organizations to effectively manage resource availability within Azure. They can be priced up to 90% lower than standard Azure VMs, though Microsoft does have the authority to evict these instances with little prior warning.
While many administrators view the use of Spot VMs as a risky endeavor, the potential for eviction can be mitigated by setting the maximum price to -1 for the Azure Spot VM. This strategic approach allows you to prevent evictions by agreeing to pay a higher amount for the spot instance, capped at the cost of a typical VM. By carefully managing your pricing parameters, you can lessen the likelihood that Microsoft will reallocate your VM in favor of another organization’s instance that lacks such a maximum price cap.
Although employing Azure Spot VMs for production environments may not be advisable, they can be effectively used to enhance development and quality assurance servers.
When it comes to disks linked with an Azure VM, it’s important to assess them thoroughly. What is your objective with the VM? Are you looking for raw storage capacity, superior performance, or ease of movement?
Administrators can optimize storage options while keeping expenses in check through various strategies. By investing a little more money and time to set up the VM disk, performance can be enhanced by building a storage pool that combines multiple disks into a single virtual disk.
A common mistake among many administrators is to connect one large disk to the Azure VM as the primary data disk, which might not be the most efficient choice. By utilizing multiple smaller disks and merging them into one logical disk, whether through Storage Spaces in Windows or Logical Volume Manager (LVM) in Linux, administrators can achieve greater IOPS and higher throughput.
For instance, if an administrator aims to create an Azure VM featuring 1 TB of disk space with robust I/O capabilities, they might select an E4-2as Windows Server instance located in the East US 2 region. Opting for a 1 TB S30 mechanical HDD will yield 500 IOPS and a throughput rate of 60 MB/s. This setup would incur a cost of $359 per month.
Using two S20 mechanical HDD 512 GB disks provides you with 1,000 IOPS and a throughput of 120 MB/s for a monthly fee of $361.
On the other hand, opting for four S15 HDD 256 GB disks allows you to achieve 2,000 IOPS along with a throughput of 240 MB/s for $363 each month.
In this instance, the additional cost is roughly $4 more each month, yet you gain four times the performance compared to the single large disk arrangement. This level of speed is sufficient for running various workloads, including SQL Server.
For reference, a conventional SSD 1 TB disk is priced at $395 per month. By leveraging multiple smaller disks, the organization can save $384 annually per server. When this setup is applied across a range of virtual machines, the total yearly savings could easily exceed thousands of dollars for a large organization.
The configuration of HDD disks can significantly impact costs while still fulfilling performance needs, acting as a cost-effective alternative to pricier SSD disks. For the purpose of high availability, Azure implements locally redundant storage (LRS), ensuring that three copies of the data are stored within the primary region of a virtual machine (VM).
When leveraging Storage Spaces, the same principles that apply to any RAID setup are relevant. It is essential to include disks of uniform size within the storage pool and adhere to the column count specified in the pool settings.
Opting for smaller disks enables more gradual scaling at a more favorable cost. For instance, if two 2 TB disks are in use and an additional 100 GB is required, you would need to add two more 2 TB disks. By selecting smaller disks, you can maintain lower expenses.
Despite the advantages of using smaller disks, it’s important to note that Storage Spaces has a limit on the number of disks that can be utilized per VM. It is advisable not to exceed five or six disks for each VM. Each SKU may vary, so it’s prudent to consult Microsoft’s documentation.
Since the added disks are backed by LRS redundancy, it’s permissible to set up a single boot disk to contain the operating system files.
The following procedure establishes a storage pool using four disks within a Windows Server 2019 virtual machine, which will be represented as the F: drive.
Begin by provisioning the virtual machine in Azure, incorporating the OS disk along with four S15 HDD disks, each with a capacity of 256 GB.
After the virtual machine is up and running, navigate to the Storage Pools section in Server Manager, and select Rescan Storage to detect the newly integrated disks.
To start, you need to merge the disks into a storage pool. In Windows storage terminology, these unallocated disks are known as primordial disks, which you will use to establish a storage pool. Access the Storage Pools section, select the primordial area, and then click on Tasks followed by New Storage Pool. A wizard will guide you through the process; simply provide a name and a description for your storage pool.
Next, incorporate the disks while keeping the default settings intact. Click Next to proceed to the confirmation screen where you will click the Create button.
Once the storage pool is created, the subsequent task is to set up the virtual disk. Navigate back to the main view of Storage Pools, choose your newly created storage pool, and under the Virtual Disks tasks menu, select New Virtual Disk.
Continue through the wizard to configure the virtual disk by assigning a name, choosing the storage layout, and specifying the size, while default settings can be maintained for the other sections. For the storage layout, opt for Simple, which utilizes all disks without any redundancy, representing the RAID 0 or disk striping for optimal performance. Choose Maximum size, advance to Confirmation, and then click Create to finalize the virtual disk creation and complete the process.
To proceed, right-click on the virtual disk and choose New Volume. This will initiate a wizard where you’ll assign the drive letter to F: and format the volume using a file system, typically NTFS. Completing these steps results in efficient storage for your workload at a minimal cost.
Keep in mind the following best practices to ensure that your Azure disk configuration aligns with your requirements:
Stuart Burns serves as an enterprise Linux administrator at a top company focused on catastrophe and disaster modeling.