Azure SQL Database: Optimize costs using Serverless Tier
    • Dark
      Light
    • PDF

    Azure SQL Database: Optimize costs using Serverless Tier

    • Dark
      Light
    • PDF

    Article summary

    #ServerlessTips - Azure Cost Management
    Author: Tidjani Belmansour Azure MVP

    This article is part of a series on the topic of Cloud Cost Optimization.

    While Cloud Cost Optimization requires robust monitoring, there exist some best practices that we will share with you throughout this series.

    In today’s article, we will see how the Serverless Tier for Azure SQL Database can help you optimize Azure SQL databases costs.

    In our article about using Elastic Pools to optimize Cloud costs, we mentioned that many still provision capacities (aka, choose a SKU) according to the maximum expected load on the database, and most of the time, this approach results in a waste of capacity (and money) as you can see on this figure:
    download 801

    When you have a database with an unpredictable load, you may want to take advantage of autoscaling to meet demand while optimizing costs. That is where you would consider the Serverless Tier for Azure SQL Database.

    Although you can setup monitoring alerts and trigger some processing (e.g., an Azure Functions) to scale the SKU up and down, this might not be an appropriate solution because: (a) it takes time, and (b) active connections will be dropped, resulting in a poor user experience.

    With the Serverless Tier, autoscaling happens very quickly and connections are not dropped.

    We can either create a new Azure SQL Database using the Serverless Tier, but we can also change the tier of an existing one to Serverless. Simply go to “Compute + Storage”, select a vCore-based service tier and then check “Serverless” under “compute tier”. There, we will be able to define the minimum and maximum amount of vCores.

    It is interesting to note that vCores are billed per second, hence ending up being very a cost-effective solution.

    download 811

    We will also be able to configure the auto-pause delay or disable it:

    download 821

    Auto-pause allows for the database to go into “sleep” mode if no activity has been recorded for the specified period.

    Pay careful attention to this!

    When the database is in auto-pause mode, the first connection to the database will fail and throw an error but will serve as a waking signal to resume the database.

    Your application that connects to the database will then need to implement some retry policy to handle that situation, providing an ideal user experience.

    And there you have it! You can now add Azure SQL Database Serverless Tier to your Cost Optimization Strategy. Just keep in mind that when the database is in “auto-pause” mode, the first connection will fail but will serve as a waking signal for the database.

    MicrosoftTeams-image 443


    Was this article helpful?