Overview
Azure SQL Database provides flexible scaling options to match workload demands while controlling costs. Choose between the DTU‑based or vCore‑based purchasing models, leverage elastic pools for multi‑database scenarios, and enable auto‑scale to react to usage spikes automatically.
Key Concepts
- DTU (Database Transaction Unit): A blended measure of CPU, memory, reads, and writes.
- vCore (Virtual Core): Separate allocation of compute and storage for granular control.
- Elastic Pools: Share resources across a group of databases.
- Auto‑scale: Dynamically adjust resources based on thresholds.
DTU‑Based Model
The DTU model provides predefined performance tiers. Use the az sql db update command to scale.
az sql db update \\
--resource-group MyResourceGroup \\
--server myserver \\
--name mydatabase \\
--service-objective S3
Available Tiers
| Tier | DTUs | Max Size | Recommended For |
|---|---|---|---|
| Basic | 5 | 2 GB | Development & small apps |
| Standard S1 | 10 | 250 GB | Light production workloads |
| Standard S3 | 100 | 1 TB | Medium workloads |
| Premium P1 | 125 | 500 GB | High‑performance OLTP |
vCore‑Based Model
The vCore model decouples compute and storage, offering more predictable performance.
Scaling Compute
az sql db update \\
--resource-group MyResourceGroup \\
--server myserver \\
--name mydatabase \\
--capacity 4 \\
--family Gen5 \\
--tier GeneralPurpose
Pricing Tiers
- General Purpose: Balanced compute and storage for most workloads.
- Business Critical: Highest resilience and low‑latency storage.
Elastic Pools
Group databases that have variable usage patterns to share a pool of DTUs or vCores.
Create a Pool (vCore)
az sql elastic-pool create \\
--resource-group MyResourceGroup \\
--server myserver \\
--name mypool \\
--capacity 8 \\
--family Gen5 \\
--tier GeneralPurpose
Assign a Database to the Pool
az sql db update \\
--resource-group MyResourceGroup \\
--server myserver \\
--name mydatabase \\
--elastic-pool-name mypool
Auto‑scale
Azure Monitor autoscale can adjust the vCore count based on CPU usage.
Enable Autoscale
az monitor autoscale create \\
--resource /subscriptions/xxxx/resourceGroups/MyResourceGroup/providers/Microsoft.Sql/servers/myserver/databases/mydatabase \\
--name sql-db-autoscale \\
--min-count 2 --max-count 16 --count 4
Scale Rules Example
{
"rules": [
{
"metricTrigger": {
"metricName": "cpu_percent",
"metricNamespace": "Microsoft.Sql/servers/databases",
"timeGrain": "PT1M",
"statistic": "Average",
"timeWindow": "PT5M",
"timeAggregation": "Average",
"operator": "GreaterThan",
"threshold": 70
},
"scaleAction": {
"direction": "Increase",
"type": "ChangeCount",
"value": "2",
"cooldown": "PT5M"
}
},
{
"metricTrigger": {
"metricName": "cpu_percent",
"operator": "LessThan",
"threshold": 30
},
"scaleAction": {
"direction": "Decrease",
"type": "ChangeCount",
"value": "2",
"cooldown": "PT5M"
}
}
]
}
Performance Monitoring
Use Query Performance Insight and Azure Monitor metrics to understand when to scale.
- Query Performance Insight:
az sql db show-performance-insight - Metric alerts: Set up alerts for DTU/vCore consumption spikes.
Frequently Asked Questions
- Can I switch between DTU and vCore models?
- Yes. Use
az sql db update --service-objectivefor DTU or change the tier to vCore. A brief downtime may occur. - How long does a scaling operation take?
- Most scaling actions complete within 5‑10 minutes, depending on the target tier.
- What happens to my data during scaling?
- Data remains online; Azure performs a live migration to the new compute resources.