Azure SQL Database Serverless Compute Tiers
Azure SQL Database serverless is a compute tier for single databases, elastic pools, and data warehouses that automatically scales compute based on workload demand and then pauses compute to automatically save costs during idle periods.
The serverless compute tier is ideal for workloads with intermittent or spiky usage patterns, and for smaller databases with variable usage demands. It offers a cost-effective solution by automatically pausing compute when the database is not in use, thereby eliminating costs associated with idle compute resources.
Key Features of Serverless Compute Tiers
- Automatic scaling of compute based on actual workload needs.
- Automatic pausing of compute when no activity is detected, leading to cost savings.
- Automatic resume of compute when new activity is detected.
- Configurable minimum and maximum compute capacities to control costs and performance.
- Pay-per-use model for compute, making it highly cost-efficient for variable workloads.
- Suitable for single databases, elastic pools, and data warehouses.
How Serverless Works
When a serverless database is active, Azure SQL Database provisions and manages the compute resources, dynamically adjusting them as needed. When the database becomes inactive for a defined period, the compute resources are automatically paused. This pausing process involves shutting down the compute node and releasing the associated compute costs. When new activity occurs (e.g., a query is submitted), the compute node is automatically restarted, and the database becomes available again. There may be a short delay during the resume process.
Configuration Parameters
When configuring a serverless compute tier, you specify:
- Minimum vCores: The minimum amount of compute power provisioned. This impacts the database's resume time and the cost when it's running.
- Maximum vCores: The maximum amount of compute power that the database can scale up to.
- Auto-pause delay: The period of inactivity after which the compute will be paused.
Use Cases
- Development and testing environments.
- Applications with unpredictable or infrequent usage.
- Smaller databases that don't require a constant, high level of compute.
- Reporting databases with periodic query loads.
Performance Considerations:
While serverless offers great cost savings, it's important to be aware that the auto-resume process might introduce a small latency for the first query after a period of inactivity. For mission-critical applications requiring consistent low latency, consider a provisioned compute tier.
Managing Serverless Compute
You can manage serverless compute tiers through the Azure portal, Azure CLI, PowerShell, and ARM templates.
Example: Creating a Serverless Database (Azure CLI)
az sql db create \
--resource-group "myResourceGroup" \
--server "myserver" \
--name "mydatabase" \
--edition "GeneralPurpose" \
--family "Gen5" \
--capacity "2" \
--auto-pause-delay 60 \
--min-capacity 0.5 \
--max-capacity 4
In this example:
--capacity "2" sets the initial compute size.
--auto-pause-delay 60 sets the auto-pause delay to 60 minutes.
--min-capacity 0.5 sets the minimum vCores to 0.5.
--max-capacity 4 sets the maximum vCores to 4.
Benefits
- Cost Savings: Significantly reduce costs by only paying for compute when it's actively used.
- Simplicity: Automatic scaling and pausing reduce the need for manual performance tuning and resource management.
- Flexibility: Adapts to fluctuating workloads without manual intervention.
Limitations
- Potential for initial latency on the first query after auto-resume.
- Less predictable performance compared to provisioned tiers for consistent, high-demand workloads.
- Not suitable for workloads that require continuous, high availability of compute resources at all times.
For more detailed information on specific configuration options, pricing, and performance best practices, please refer to the official Azure SQL Database Serverless Documentation.