Azure SQL Database Sizing and Cost Optimisation
Azure SQL Database Sizing and Cost Optimisation
This post looks at Azure SQL Database default sizing and what users need to know. The new default is about ten times the price of a previous Standard S1 or four times the price of an S2 database. We have seen many customers paying ~£330 per database per month when all they really need is a standard one. For example, a standard S0 comes in at ~£11 per month while the S1 and S2 SKUs are ~£22 and ~£56 per month respectively. Just from this we can see it is important to ensure your environments have the correct database SKUs during setup time.
The new sizes are created using the vCore purchasing model as opposed to the DTU based model we are used to. The default size also depends on how you create the databases, whether through the Azure Portal, SQL Server Management Studio (SSMS), or via Script for example. If you create a database using SQL Server Management Studio you will see the Configure SLO (Service Level Objective) box. The SLO is Gen 4 or Gen 5 and the Edition is General Purpose with a max size of 32 GB. It would have previously been DTU and Standard S2. The Gen 4 lowest 1 vCore option is showing as £160 per month while the lowest Gen 5 takes it up to £316 per month. This can be changed in SMSS when creating a database as required but the default will be the new purchasing models.
Here we can see what this looks like in the Portal with pricing in GBP.
Azure SQL Database Sizing – Gen 4, 1 vCore size
Azure SQL Database Sizing – Gen 5, 2 vCore size
Default Size in SQL SSMS
What’s the Difference Between DTU and vCore Purchase Options?
Basically, the DTU (Database Transaction Units) model uses a blend of compute, memory and storage designed for “common use cases”. The vCore model is the latest and default option, where cpu cores can be selected to closely match specifications of a server. vCore also allows for independent scaling of cpu and storage as well as Hybrid Use licensing benefits.
Personally, I don’t see a requirement for any “minimum” default database size to be £160 or £316 per month.
This article is not intended to go into detail on the different purchasing options. Please find more information here:- https://docs.microsoft.com/en-us/azure/sql-database/sql-database-purchase-models
How Can We Control SQL Database Deployment Sizes?
Ideally users would not have the ability to deploy databases, as this should be done using scripts, automation and approval processes. We see many organisations that do not have these mechanisms in place, so what other options are there? Use custom Azure Policies to highlight or deny the creation of any unapproved database SKUs.
How Else Can We Optimise Azure SQL Database Costs?
Deploying databases and hoping for the best can be costly in the long run with increased risk of future service outage.
We have recently been working with customers to save SQL Server spend. In one case the monthly bill was reduced by ~£20,000, yes £20,000! Understanding what is in use vs requirements can have a dramatic impact on performance, and yield significant cost savings..
Follow some of our high level tips below to start getting your databases in shape:-
1. Database Archiving and Housekeeping
Ensure your databases are not storing more data than necessary, and are compliant with customer and GDPR requirements. Do you really need to store data indefinitely? If you do, then fine. If you do not, then make sure there is something in place to remove old data. There are many ways to do this and data partitioning is just one effective way of doing this. Also make use of DBCC (Database Console Commands) for maintenance such as DBCC ShrinkDatabase to bring database sizes back down after large archiving jobs to ensure you get the best pricing.
2. Correct Service Tier, SKU and Database Settings
Ensure you have tested the various options for hosting your Platform as a Service (PaaS) databases whether it is vCore or another model. Look at database level settings such as MAXDOP which can also affect query performance.
3. Review Azure SQL Database Recommendation but do not Blindly Follow Them
Use the performance metrics and other recommendations provided by Azure SQL Server. Evaluate “Long Running Queries” to identify and view timings and frequency of slow running queries.
Azure SQL may provide index recommendations but they do not take into account inserts and updates and may not always be optimal for your use case. The recommendations would not pick up on database design issues and would not suggest alternative solutions such as query re-write, index column ordering or adding indexed views for example. A specialist such as ourselves, another Microsoft partner or experienced DBA can help with database design to yield significant benefits.
4. Intelligent Insights and Azure SQL Analytics
Intelligent Insights is a new service that uses AI technology to monitor your databases for many metrics such as wait times, locking and more to look for problems and provide root cause analysis. Use Azure SQL Analytics, a reporting tool for all your SQL Servers and integrates with Azure Monitor for intelligent performance troubleshooting.
Organisations are spending way more than necessary on their cloud environments by simply using the defaults provided by the platform/s. Virtual Machines (VMs) are another example of this. Default VM disks offered by Microsoft are the more expensive SSD type, rather than Standard disks. Factors like this, plus correct licensing, automation and governance all help to ensure services run optimally and cost efficiently. If you think your organisation is still over-spending, follow the steps in this guide as a starting point. Get in touch to speak with our experts as we love to help our customers save money.