Managing Azure SQL Database And Azure Storage Costs

In this post I’ll highlight a few ideas around managing Azure SQL Database and Azure Storage costs. It follows on my previous post that looked at managing Azure costs when using Azure Virtual Machines and Azure Subscriptions in general.

Azure SQL Database

  • If you have multiple databases with occasional/spiky workloads you can reduce costs by using Elastic Pools to share the pooled DTUs among your databases. If you use Azure Advisor it will analyse your Azure SQL usage and recommend Elastic Pools if your database instances will benefit from it.
  • Keep an eye on Azure SQL service tier updates. I had some database in the Premium tier purely based on the maximum DTUs per database required but I was able to move some of them to Standard tier after the recent service tier updates.
  • If you have high database performance requirements but you can tolerate a lower SLA and some downtime to recover from backups consider using the Premium RS tier which was in preview at the time of writing.
  • Investigate whether running SQL Server on Azure Virtual Machines will be more cost effective than Azure SQL Database. It depends greatly on your requirements, database size and utilisation but keep the following in mind:
    • If you are using SQL for dev/test you can use SQL Server Developer Edition and avoid SQL licensing costs.
    • If your production databases are very small you could get away with using SQL Express but keep the other limitations in mind.
    • You can bring your own licence for SQL running on Azure VMs.
    • If you have high availability requirements using Azure SQL is much less effort  and cost than running VMs. Azure SQL comes with a 99.99% uptime guarantee. VMs have a 99.95% uptime guarantee if you have multiple instances in an availability set plus you have to replicate to another set of VMs in a second Azure region and pay for multiple SQL licences.
    • If your database is only in use for a portion of the day you can switch the virtual machine hosting it off after hours.

Azure Storage

  • Premium Disks and Managed Disk storage is charged per disk size not disk space used while Standard storage is charged by disk space used.
  • Standard disks incur an access cost measured in 10,000 IO transaction batches but Premium Disks and Managed Disks don’t.
  • You can combine disks to achieve higher IOPS. Weigh up the cost and performance of Premium Storage Disks versus multiple Standard Storage Disks especially if you need lots of space.
  • If your data will not be accessed very often consider using Azure Cool Storage.
  • The default data redundancy setting for Standard Storage is read-access geographically redundant which means you pay for a second copy in another Azure region. For dev/test storage you may not need that level of redundancy since Microsoft keeps 3 copies in the data center anyway and you can rather use locally redundant storage.
  • Delete unused VHD files and Managed Disks. When you delete a VM its disks and underlying VHD files are not deleted. Same goes for VMs using Managed Disks although in this case there is no VHD file visible to you, just the Managed Disk to delete.
  • Don’t create a VM just to host a file share, rather use Azure Files.
 
Francois Delport

Managing Azure Costs

Managing Azure costs is an important but sometimes overlooked aspect of cloud utilisation. Many customers wrongfully believe moving to the cloud will automatically be cheaper than hosting it yourself. Truth is cloud can be cheaper but it depends on your requirements and managing your costs. There is a wide spectrum of remedies to lower your costs ranging from simple non-technical steps to rearchitecting applications for serverless computing. In this post I’m going to cover some quick wins you can achieve when using virtual machines.

Managing Azure Costs

To reduce your Azure costs you have to measure it first. There are a few ways to view Azure costs depending on whether you are using an Enterprise Agreement, CSP partner or Visual Studio subscription. In the Azure Portal under the Subscriptions blade you will find some basic information for the current month. In the Cost Analysis section you can filter on different resource groups, types and time periods. In the new Cost Management + Billing blade you can sign up for Cloudyn cost management with more detailed analysis. Eventually it will be folded into the Azure Portal but for the moment you are directed to an external website where you have to sign up for a trail that is free until June 2018. Enterprise Agreement customers can use the EA portal and PowerBI to analyse their bill.

First Step

The easiest and first step you can take is to use the Azure Advisor blade to display any cost recommendations. It is very basic but can provide information around virtual machine under utilisation and Azure SQL databases that can benefit from elastic pools. While you are there also take a look at the security and performance recommendations.

Azure Virtual Machines

A few things to keep in mind to manage your Azure costs when using Azure Virtual Machines.

  • Newer generation virtual machines can sometimes be cheaper. Take for example D* v3 and D* v2 machines, taking into account that there is a small difference in RAM and temporary storage, v3 is cheaper. It was a similar situation when D* v1 was superseded by D* v2.

    Managing Azure Costs
    Managing Azure Costs
  • If you have Azure Batch jobs that are not time critical and they can safely be interrupted and resumed Azure Batch low priority virtual machines can offer a good discount, link.
  • If you are running workloads that occasionally consume high CPU cycles Azure B series virtual machines could be cost effective link. In short you build up credits when CPU utilisation is low which you then spend on bursts of high CPU utilisation.
  • Automatically shut down virtual machines when you don’t use them. It used to require a script and automation account but now it is available in the virtual machine blade.

    Managing Azure Costs
    Managing Azure Costs
  • If you have Software Assurance you can use your existing Windows Server licenses in Azure and only pay for the base computer power you consume. You can read more about Azure Hybrid Benefit here.
  • If you are a Visual Studio subscriber using Azure for development and testing you can get a discount on various Azure services by creating Azure Dev/Test subscriptions. These subscriptions are limited to development and testing workloads, link here. Each active Visual Studio subscriber also qualifies for monthly Azure credits but you have to activate the benefit first, more info here.
  • At the time of writing Reserved Instances were not available yet but it can also bring down cost by paying upfront for virtual machines, more info here.
  • Scale in and out by adding and removing VMs as needed rather than using larger VM instances.

Links to further posts covering Azure cost management
Managing costs when using Azure SQL Database and Azure Storage

 
Francois Delport