azureazure-sql-databaseazure-automation

Vertical Scale Azure SQL database based on Time of Day and DTU


I have an Azure Database on P1. It is a mission-critical database. The database usually uses around 0.5% to 5% DTU at P1 level. It occasionally (once every couple of days) gets to 99.8% DTU and the requests time-out. I get an email alert from Azure at 80% DTU, so I can log to the portal and Scale-up to P2 or P4. I found a PowerShell script to scale the Database, but I did not understand how I can tie it to DTU level. Can you point me to some resources on how to Vertically scale Up (and Down) based on the DTU usage?


Solution

  • The easiest way for you would be to create an alert, that would launch a webhook that would scale the database.

    https://learn.microsoft.com/en-us/azure/sql-database/sql-database-insights-alerts-portal#sql-database-alert-values-and-thresholds
    https://learn.microsoft.com/en-us/azure/automation/automation-webhooks

    and\or if you know the time, just scale database with a runbook with a schedule
    https://learn.microsoft.com/en-us/azure/automation/automation-schedules